[prev in list] [next in list] [prev in thread] [next in thread] 

List:       linux-nfs
Subject:    Re: [PATCH nfsd] SQUASH 8dc9e02aed76 lib: add light-weight queuing mechanism.
From:       Chuck Lever <chuck.lever () oracle ! com>
Date:       2023-09-28 13:42:30
Message-ID: ZRWCxiizvlcxJfz9 () tissot ! 1015granger ! net
[Download RAW message or body]

On Wed, Sep 27, 2023 at 06:11:52PM -0400, NeilBrown wrote:
> 
> Remove assumption that kmalloc never fails.
> 
> Signed-off-by: NeilBrown <neilb@suse.de>
> ---
> 
> Hi Chuck,
>  please squash this into the relevant patch - thanks.

Done! Will update the public nfsd-next branch later today.


> Hi Dan,
>  thanks for the review!
> 
> NeilBrown
> 
>  lib/lwq.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/lib/lwq.c b/lib/lwq.c
> index 8a723b29b39e..57d080a4d53d 100644
> --- a/lib/lwq.c
> +++ b/lib/lwq.c
> @@ -111,6 +111,8 @@ static int lwq_test(void)
>  		threads[i] = kthread_run(lwq_exercise, &q, "lwq-test-%d", i);
>  	for (i = 0; i < 100; i++) {
>  		t = kmalloc(sizeof(*t), GFP_KERNEL);
> +		if (!t)
> +			break;
>  		t->i = i;
>  		t->c = 0;
>  		if (lwq_enqueue(&t->n, &q))
> @@ -127,7 +129,8 @@ static int lwq_test(void)
>  			printk(KERN_INFO " lwq: ... ");
>  		}
>  		t = lwq_dequeue(&q, struct tnode, n);
> -		printk(KERN_CONT " %d(%d)", t->i, t->c);
> +		if (t)
> +			printk(KERN_CONT " %d(%d)", t->i, t->c);
>  		kfree(t);
>  	}
>  	printk(KERN_CONT "\n");
> -- 
> 2.42.0
> 

-- 
Chuck Lever
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic