[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20220325144755.c0a92c6fd934b4cb98c41c16@linux-foundation.org>
Date: Fri, 25 Mar 2022 14:47:55 -0700
From: Andrew Morton <akpm@...ux-foundation.org>
To: xkernel.wang@...mail.com
Cc: glider@...gle.com, andreyknvl@...il.com, elver@...gle.com,
dvyukov@...gle.com, ryabinin.a.a@...il.com,
kasan-dev@...glegroups.com, linux-mm@...ck.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] lib/test_meminit: optimize
do_kmem_cache_rcu_persistent() test
On Wed, 23 Mar 2022 11:48:24 +0800 xkernel.wang@...mail.com wrote:
> From: Xiaoke Wang <xkernel.wang@...mail.com>
>
> To make the test more robust, there are the following changes:
> 1. add a check for the return value of kmem_cache_alloc().
> 2. properly release the object `buf` on several error paths.
> 3. release the objects of `used_objects` if we never hit `saved_ptr`.
> 4. destroy the created cache by default.
>
> ...
>
> --- a/lib/test_meminit.c
> +++ b/lib/test_meminit.c
> @@ -300,13 +300,18 @@ static int __init do_kmem_cache_rcu_persistent(int size, int *total_failures)
> c = kmem_cache_create("test_cache", size, size, SLAB_TYPESAFE_BY_RCU,
> NULL);
> buf = kmem_cache_alloc(c, GFP_KERNEL);
> + if (!buf)
> + goto out;
OK, Normally we don't bother checking allocation success in __init
code, but this test can run via modprobe, so I guess checking is the
right thing to do.
Powered by blists - more mailing lists