From: Andrew Morton <akpm@linux-foundation.org>
To: xkernel.wang@foxmail.com
Cc: glider@google.com, andreyknvl@gmail.com, elver@google.com,
dvyukov@google.com, ryabinin.a.a@gmail.com,
kasan-dev@googlegroups.com, linux-mm@kvack.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] lib/test_meminit: optimize do_kmem_cache_rcu_persistent() test
Date: Fri, 25 Mar 2022 14:47:55 -0700 [thread overview]
Message-ID: <20220325144755.c0a92c6fd934b4cb98c41c16@linux-foundation.org> (raw)
In-Reply-To: <tencent_7CB95F1C3914BCE1CA4A61FF7C20E7CCB108@qq.com>
On Wed, 23 Mar 2022 11:48:24 +0800 xkernel.wang@foxmail.com wrote:
> From: Xiaoke Wang <xkernel.wang@foxmail.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.
prev parent reply other threads:[~2022-03-25 21:47 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-23 3:48 xkernel.wang
2022-03-25 21:47 ` Andrew Morton [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220325144755.c0a92c6fd934b4cb98c41c16@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=andreyknvl@gmail.com \
--cc=dvyukov@google.com \
--cc=elver@google.com \
--cc=glider@google.com \
--cc=kasan-dev@googlegroups.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=ryabinin.a.a@gmail.com \
--cc=xkernel.wang@foxmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox