Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp10149346rwb; Fri, 25 Nov 2022 01:25:22 -0800 (PST) X-Google-Smtp-Source: AA0mqf7okl5qOz6uLKX2cWCaWU7yHgkm+BRm7ydjf+whJYeGPq4K6bv9UYQ3+gdbynBrDLxUHP7e X-Received: by 2002:a17:907:d412:b0:7bc:68cc:7913 with SMTP id vi18-20020a170907d41200b007bc68cc7913mr2180663ejc.589.1669368321667; Fri, 25 Nov 2022 01:25:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669368321; cv=none; d=google.com; s=arc-20160816; b=uDlkP5oihN0ZC871967IK0/roMz2SaF+HbHH93/8Tk1VKBpKzrGUAJRaxFkEqDQQvj vLpi7QJu3lmqm1B3izxuqPkQC21GaOkPZArxMFnY7enpXpjpKGSRA0IkVKR5mXDuzpeM DxaAh5WcDWPDXAO6zT7TEI48fTyMX/O6N9Wno4kbbX68h1ouKX8cM9zSczEoYFuS9Yld N0dxzEtu33bIInAlxO21O8x46bu8jjCxYleJvCcY82xAqE+thMnhjg0ILN4EsDXuItDt CVpSoyQcOdKT8oJIHDoGtVJO1WDUiwgxY/u0St5+qIgZf+JJd1RZt/uoYTutQF+F63fn ccKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=hBeDC4z748ncYZCuQ2PKZ2UYAIe12ZpvjcoXNfVieoI=; b=Y3EzbK/KM7N5iqyMI9yZYqomUhWKrEDBEJdwcA5OjTehLZzGydPHLEY3n0spc59nDP 84PF39ho35qJuJBWP3K4Ok6+lFdewIOsXLVkudR5dKoaCxzdvcPeyChxRT8zOrZRRON8 OtaKO5SS73lX6BBDLPDyauKnAMlDjlTFJqdP2ZyL7+8PLVWLE89ItPyR3dLOlx10h9Rm ZAq7pWR922gVzZtejNDeZCCYJhXaAUYiin5smjnRb2PpPVnEVVvmI59j/kAS4ioUWRuq Lt8Y13wu2QcMSTfUAKs16ytod8tp8NKXvw2wB1klwW3rcSMASjAvH5s6SxZFjvVlga+a D7uw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=HmqxbSCw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bm11-20020a0564020b0b00b00457c6b5dc07si1815556edb.455.2022.11.25.01.24.59; Fri, 25 Nov 2022 01:25:20 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=HmqxbSCw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229675AbiKYIda (ORCPT + 86 others); Fri, 25 Nov 2022 03:33:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50474 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229877AbiKYIdZ (ORCPT ); Fri, 25 Nov 2022 03:33:25 -0500 Received: from mail-ua1-x930.google.com (mail-ua1-x930.google.com [IPv6:2607:f8b0:4864:20::930]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E42193134F for ; Fri, 25 Nov 2022 00:33:23 -0800 (PST) Received: by mail-ua1-x930.google.com with SMTP id 97so1329606uam.0 for ; Fri, 25 Nov 2022 00:33:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=hBeDC4z748ncYZCuQ2PKZ2UYAIe12ZpvjcoXNfVieoI=; b=HmqxbSCwLKwpqduW28X9/T0JaD3ICygqfLAbFj+LWHw3fQZpJGOUXIS4d6LtThLxkq 7sAzl4xvKtCpWuKt5AliGa6H6eUaKGeVCWjy4NAAtadl6NqzEAM1NhO47tCE26gaqfjg YaXrsJZMI9zsvmHhXLKXvzVhIPCBFcluuoCNYE0cuqydYgkPcxQ5nclF70w23YeNj+lN pff8pur1yIzwbS5xkOb0T9WEUaE6gOS4iBAO1qJMNCn28eY0ggU3sQpXXyMhbt/xqTrv JCKcJkFZiIE1h4pWOcAc65euzibJYNi5dlE/I/wxZUzeDSGhbmI/GBdzrJaKRD0LQUA2 lB2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=hBeDC4z748ncYZCuQ2PKZ2UYAIe12ZpvjcoXNfVieoI=; b=PE9C85w4vUNbxb/cX+2UFfEv2JRr+b9nj3uKd/yrwGZ+GVCRo14Htj2FS7snIIYfer mh0RfZ0LmDiQEbkcm95rxEew1u+fY20sTF8vzuplv5QXdGzDAifcS8yDR5C+7t4N9Juk nUu00e3L2OTZmjVFa0pNVzFInndIzgPkYubl0DWSZKZWEcpcuLKzGBZqj2iTEhzeaA/H pGsbQA83HnSlmih24hdUYwFdIe5RVCeduOi7nWC5lZLsTbMbNx+/XbvdF3l3IgKxEIuz I5dS7R/PsSnJBid6rGQXzOlNFWdUjvRaNak1fmBbafFxOhN0jaYCLmH67dcWONL7cyIR EWZA== X-Gm-Message-State: ANoB5pmwt7+kEPxNKjbdX62tixcHjgErX3T5v9/GQ2VR3jSoG9f0ZBPZ xy5u7KGBqR8RTJpltkmLcdllnQJyH5raLu18Nr65Zw== X-Received: by 2002:a05:6130:316:b0:418:b66a:6f26 with SMTP id ay22-20020a056130031600b00418b66a6f26mr11289425uab.21.1669365202876; Fri, 25 Nov 2022 00:33:22 -0800 (PST) MIME-Version: 1.0 References: <20221119081252.3864249-1-davidgow@google.com> <20221119081252.3864249-3-davidgow@google.com> In-Reply-To: From: David Gow Date: Fri, 25 Nov 2022 16:33:11 +0800 Message-ID: Subject: Re: [PATCH v3 3/3] mm: slub: test: Use the kunit_get_current_test() function To: Hyeonggon Yoo <42.hyeyoo@gmail.com> Cc: Brendan Higgins , Daniel Latypov , Shuah Khan , kunit-dev@googlegroups.com, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Kees Cook , linux-doc@vger.kernel.org, linux-mm@kvack.org, Oliver Glitta , Christoph Lameter , Vlastimil Babka , David Rientjes , Andrew Morton Content-Type: multipart/signed; protocol="application/pkcs7-signature"; micalg=sha-256; boundary="000000000000f072fa05ee475fa5" X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --000000000000f072fa05ee475fa5 Content-Type: text/plain; charset="UTF-8" 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 > > Cc: Hyeonggon Yoo <42.hyeyoo@gmail.com> > > Cc: Christoph Lameter > > Cc: Vlastimil Babka > > Cc: David Rientjes > > Cc: Andrew Morton > > Signed-off-by: David Gow > > Acked-by: Vlastimil Babka > > 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 > > +#include > > 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 --000000000000f072fa05ee475fa5 Content-Type: application/pkcs7-signature; name="smime.p7s" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="smime.p7s" Content-Description: S/MIME Cryptographic Signature MIIPnwYJKoZIhvcNAQcCoIIPkDCCD4wCAQExDzANBglghkgBZQMEAgEFADALBgkqhkiG9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