From: David Gow <davidgow@google.com>
To: Hyeonggon Yoo <42.hyeyoo@gmail.com>
Cc: Brendan Higgins <brendan.higgins@linux.dev>,
Daniel Latypov <dlatypov@google.com>,
Shuah Khan <skhan@linuxfoundation.org>,
kunit-dev@googlegroups.com, linux-kselftest@vger.kernel.org,
linux-kernel@vger.kernel.org, Kees Cook <keescook@chromium.org>,
linux-doc@vger.kernel.org, linux-mm@kvack.org,
Oliver Glitta <glittao@gmail.com>,
Christoph Lameter <cl@linux.com>,
Vlastimil Babka <vbabka@suse.cz>,
David Rientjes <rientjes@google.com>,
Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH v3 3/3] mm: slub: test: Use the kunit_get_current_test() function
Date: Fri, 25 Nov 2022 16:33:11 +0800 [thread overview]
Message-ID: <CABVgOSmCdtnFatO+EU0T9fado1h7ZW0DAzO=Y2jPvt6mTmO57A@mail.gmail.com> (raw)
In-Reply-To: <Y39Kz0hI3IOKoqrJ@hyeyoo>
[-- Attachment #1: Type: text/plain, Size: 2431 bytes --]
On Thu, Nov 24, 2022 at 6:43 PM Hyeonggon Yoo <42.hyeyoo@gmail.com> wrote:
>
> On Sat, Nov 19, 2022 at 04:12:52PM +0800, David Gow wrote:
> > Use the newly-added function kunit_get_current_test() instead of
> > accessing current->kunit_test directly. This function uses a static key
> > to return more quickly when KUnit is enabled, but no tests are actively
> > running. There should therefore be a negligible performance impact to
> > enabling the slub KUnit tests.
> >
> > Other than the performance improvement, this should be a no-op.
> >
> > Cc: Oliver Glitta <glittao@gmail.com>
> > Cc: Hyeonggon Yoo <42.hyeyoo@gmail.com>
> > Cc: Christoph Lameter <cl@linux.com>
> > Cc: Vlastimil Babka <vbabka@suse.cz>
> > Cc: David Rientjes <rientjes@google.com>
> > Cc: Andrew Morton <akpm@linux-foundation.org>
> > Signed-off-by: David Gow <davidgow@google.com>
> > Acked-by: Vlastimil Babka <vbabka@suse.cz>
>
> Acked-by: Hyeonggon Yoo <42.hyeyoo@gmail.com>
> with small comment:
>
Thanks very much!
> > ---
> >
> > This is intended as an example use of the new function. Other users
> > (such as KASAN) will be updated separately, as there would otherwise be
> > conflicts.
> >
> > We'll take this whole series via the kselftest/kunit tree.
> >
> > Changes since v2:
> > https://lore.kernel.org/all/20221025071907.1251820-3-davidgow@google.com/
> > - Get rid of a redundant 'likely' (Thanks Vlastimil Babka)
> > - Use current->kunit_test directly when we already know a test is
> > running. (Thanks Vlastimil Babka)
> > - Add Vlastimil's Acked-by.
> >
> > There was no v1 of this patch. v1 of the series can be found here:
> > https://lore.kernel.org/linux-kselftest/20221021072854.333010-1-davidgow@google.com/T/#u
> >
> > Cheers,
> > -- David
> >
> > ---
> > lib/slub_kunit.c | 1 +
> > mm/slub.c | 3 ++-
> > 2 files changed, 3 insertions(+), 1 deletion(-)
> >
> > diff --git a/lib/slub_kunit.c b/lib/slub_kunit.c
> > index 7a0564d7cb7a..8fd19c8301ad 100644
> > --- a/lib/slub_kunit.c
> > +++ b/lib/slub_kunit.c
> > @@ -1,5 +1,6 @@
> > // SPDX-License-Identifier: GPL-2.0
> > #include <kunit/test.h>
> > +#include <kunit/test-bug.h>
>
> Is this #include needed in slub_kunit.c?
>
Yes: kunit_get_current_test() is defined in test-bug.h.
This header contains functions which are always available, even when
KUnit is not enabled.
(It's name isn't great: we may rename/refactor it down the line...)
Cheers,
-- David
[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4003 bytes --]
next prev parent reply other threads:[~2022-11-25 8:33 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-19 8:12 [PATCH v3 1/3] kunit: Provide a static key to check if KUnit is actively running tests David Gow
2022-11-19 8:12 ` [PATCH v3 2/3] kunit: Use the static key when retrieving the current test David Gow
2022-11-22 2:21 ` Daniel Latypov
2022-11-22 3:16 ` David Gow
2022-11-23 16:59 ` Daniel Latypov
2022-11-23 15:48 ` Sadiya Kazi
2022-11-19 8:12 ` [PATCH v3 3/3] mm: slub: test: Use the kunit_get_current_test() function David Gow
2022-11-24 10:43 ` Hyeonggon Yoo
2022-11-25 8:33 ` David Gow [this message]
2022-11-22 1:31 ` [PATCH v3 1/3] kunit: Provide a static key to check if KUnit is actively running tests Daniel Latypov
2022-11-22 2:33 ` David Gow
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='CABVgOSmCdtnFatO+EU0T9fado1h7ZW0DAzO=Y2jPvt6mTmO57A@mail.gmail.com' \
--to=davidgow@google.com \
--cc=42.hyeyoo@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=brendan.higgins@linux.dev \
--cc=cl@linux.com \
--cc=dlatypov@google.com \
--cc=glittao@gmail.com \
--cc=keescook@chromium.org \
--cc=kunit-dev@googlegroups.com \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=rientjes@google.com \
--cc=skhan@linuxfoundation.org \
--cc=vbabka@suse.cz \
/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;
as well as URLs for NNTP newsgroup(s).