Re: [PATCH nfsd] SQUASH 8dc9e02aed76 lib: add light-weight queuing mechanism.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Sep 27, 2023 at 06:11:52PM -0400, NeilBrown wrote:
> 
> Remove assumption that kmalloc never fails.
> 
> Signed-off-by: NeilBrown <neilb@xxxxxxx>
> ---
> 
> 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



[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux