From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3AC06C433EF for ; Wed, 9 Feb 2022 16:58:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234524AbiBIQ6X (ORCPT ); Wed, 9 Feb 2022 11:58:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60064 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237605AbiBIQ6G (ORCPT ); Wed, 9 Feb 2022 11:58:06 -0500 Received: from alexa-out-sd-02.qualcomm.com (alexa-out-sd-02.qualcomm.com [199.106.114.39]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 059BEC05CB87; Wed, 9 Feb 2022 08:58:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; i=@quicinc.com; q=dns/txt; s=qcdkim; t=1644425890; x=1675961890; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=QoxB7339BnBkugvaYIedB66T9O8oyGrxlDFYROzaZRk=; b=rjJLLrpB9Gnq8IzsA+WruPIGHdYtEE4IaZHEEq9jnIdoIhJKnUK1cVV+ /RpCnLX7qYzRrX2KeF4mFxiqfvXz8E83ETXJxVZG63Tuf2SxR05nHtZbE nID/zrSVW2qZ1r8BKhwfnjYOYdrGbmfXClyQKUpOlN5Lpj0yXfaEZCoUK c=; Received: from unknown (HELO ironmsg-SD-alpha.qualcomm.com) ([10.53.140.30]) by alexa-out-sd-02.qualcomm.com with ESMTP; 09 Feb 2022 08:58:09 -0800 X-QCInternal: smtphost Received: from nasanex01c.na.qualcomm.com ([10.47.97.222]) by ironmsg-SD-alpha.qualcomm.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Feb 2022 08:58:09 -0800 Received: from nalasex01a.na.qualcomm.com (10.47.209.196) by nasanex01c.na.qualcomm.com (10.47.97.222) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.922.19; Wed, 9 Feb 2022 08:58:09 -0800 Received: from lsbug.qualcomm.com (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.922.19; Wed, 9 Feb 2022 08:58:07 -0800 From: Qian Cai To: Theodore Ts'o CC: Jan Kara , "Paul E. McKenney" , "Neeraj Upadhyay" , Joel Fernandes , Boqun Feng , , , , Qian Cai Subject: [RFC PATCH] jbd2: avoid __GFP_ZERO with SLAB_TYPESAFE_BY_RCU Date: Wed, 9 Feb 2022 11:57:42 -0500 Message-ID: <20220209165742.5659-1-quic_qiancai@quicinc.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nalasex01a.na.qualcomm.com (10.47.209.196) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Since the linux-next commit 120aa5e57479 (mm: Check for SLAB_TYPESAFE_BY_RCU and __GFP_ZERO slab allocation), we will get a boot warning. Avoid it by calling synchronize_rcu() before the zeroing. Signed-off-by: Qian Cai --- fs/jbd2/journal.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c index c2cf74b01ddb..323112de5921 100644 --- a/fs/jbd2/journal.c +++ b/fs/jbd2/journal.c @@ -2861,15 +2861,18 @@ static struct journal_head *journal_alloc_journal_head(void) #ifdef CONFIG_JBD2_DEBUG atomic_inc(&nr_journal_heads); #endif - ret = kmem_cache_zalloc(jbd2_journal_head_cache, GFP_NOFS); + ret = kmem_cache_alloc(jbd2_journal_head_cache, GFP_NOFS); if (!ret) { jbd_debug(1, "out of memory for journal_head\n"); pr_notice_ratelimited("ENOMEM in %s, retrying.\n", __func__); - ret = kmem_cache_zalloc(jbd2_journal_head_cache, + ret = kmem_cache_alloc(jbd2_journal_head_cache, GFP_NOFS | __GFP_NOFAIL); } - if (ret) + if (ret) { + synchronize_rcu(); + memset(ret, 0, sizeof(*ret)); spin_lock_init(&ret->b_state_lock); + } return ret; } -- 2.30.2