Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp2135670pxb; Wed, 9 Feb 2022 11:35:58 -0800 (PST) X-Google-Smtp-Source: ABdhPJwmZ5OdLQDaQO9lrFQT7AZrh/GhihADbDc6JgxWl3pJeRgbPR/xP9Tiya0ZcZViUhsrlkK5 X-Received: by 2002:a17:90b:701:: with SMTP id s1mr5088907pjz.60.1644435357684; Wed, 09 Feb 2022 11:35:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644435357; cv=none; d=google.com; s=arc-20160816; b=r1F1ZQ0+nzbn7/p2Q5AhUMXmFTQT/MwuCT05FZEZ9Zjiu9jekMYU2VyMr2xfjC5E2K iOa4BWXYbZj2/ZdBPKXGn0O13I0z5/u6+hyKgKlkfWYMnxUdhBD+3EprPZjQO+zkqRFX l7GpJ0jGzI++/YK5jVbG67WSVgpNPSN5cUc2yiJrUL2C6uI5E0X0/T5ERGwPSIvMtdIG rBb1q6+gA0wrH3QjHQBr5R29EswAi34j1jKfSly4UoR+yFDGXvmE34TRyohlfUBXSLYT 8fh3hGgSUfB2J+TIeMlFOH2BmHFv7BB/+1Zc6qEw9SiSe9Ly6BHM/E4Ak5ZCMPAcajXL nUPQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=/sf9RDeSLDsXwLAbDoDvwa7faj+vGk0nfM38INq+8DM=; b=QxQ82uKpnRBzlENWTI/zT+rHDnvTgd8WMcXj0Q7SfBUElyT1rqb93VzBGxTS9F44MP xjsuCBrzXNIcuv8+eF+BrMPuvnvzVUTqbpCE7AZebFecH7sWEqjQGVmlBBVrifhHquwa 9Gpsn71CveOulJh6ailg3KOIerksIWG3tieDy0WdUq2ctLj4ATaUgZnI7SGvGqU3PWdb iYyyZ7+UkMpk4FQg/Qu4nts3lHiC2rwxIPkGkVSIshJjURu7LmmBXwEFmByWp1kJdaqJ Dk4DSbDEu7u6xBlE0BMwjn3IOotSNuhJHveoOOZ6q5/YNHljXhTyHstRGftZzV5rAAMF 9txg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcdkim header.b=dtU8cg14; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id d19si5660769pjr.182.2022.02.09.11.35.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Feb 2022 11:35:57 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcdkim header.b=dtU8cg14; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 797ACC1038FC; Wed, 9 Feb 2022 11:35:53 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241118AbiBISwj (ORCPT + 99 others); Wed, 9 Feb 2022 13:52:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43844 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241272AbiBISu5 (ORCPT ); Wed, 9 Feb 2022 13:50:57 -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 A7218C03E96E; Wed, 9 Feb 2022 10:46:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; i=@quicinc.com; q=dns/txt; s=qcdkim; t=1644432399; x=1675968399; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=/sf9RDeSLDsXwLAbDoDvwa7faj+vGk0nfM38INq+8DM=; b=dtU8cg14oWvUSx+8UWSnB8HX/0n/b6+ZF5C/XDpQrxspjo87W5zHBy+G 0jhTkF8G27aHQ7Hqn+uskLBOJ9K/6eT/TkbROuFXd32XAr5gB0di5K1vz NXsEK0t659z7WnDTIxlq0GIy7pr1yongczUlGODt18TTlcyAv7qc7j4d0 Q=; Received: from unknown (HELO ironmsg02-sd.qualcomm.com) ([10.53.140.142]) by alexa-out-sd-02.qualcomm.com with ESMTP; 09 Feb 2022 10:46:39 -0800 X-QCInternal: smtphost Received: from nasanex01c.na.qualcomm.com ([10.47.97.222]) by ironmsg02-sd.qualcomm.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Feb 2022 10:46:38 -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 10:46:38 -0800 Received: from qian (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 10:46:36 -0800 Date: Wed, 9 Feb 2022 13:46:34 -0500 From: Qian Cai To: Jan Kara CC: Theodore Ts'o , Jan Kara , "Paul E. McKenney" , Neeraj Upadhyay , Joel Fernandes , Boqun Feng , , , Subject: Re: [RFC PATCH] jbd2: avoid __GFP_ZERO with SLAB_TYPESAFE_BY_RCU Message-ID: References: <20220209165742.5659-1-quic_qiancai@quicinc.com> <20220209181010.gfn66rvip56i54df@quack3.lan> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <20220209181010.gfn66rvip56i54df@quack3.lan> 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) X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 On Wed, Feb 09, 2022 at 07:10:10PM +0100, Jan Kara wrote: > On Wed 09-02-22 11:57:42, Qian Cai wrote: > > 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 > > No, the performance impact of this would be just horrible. Can you > ellaborate a bit why SLAB_TYPESAFE_BY_RCU + __GFP_ZERO is a problem and why > synchronize_rcu() would be needed here before the memset() please? I mean > how is zeroing here any different from the memory just being used? I'll defer to Paul and other RCU developers for more indepth explanations of the issue with the combo. The above mentioned commit has a bit information: Code using a SLAB_TYPESAFE_BY_RCU kmem_cache can have readers accessing blocks of memory passed to kmem_cache_free(), and those readers might still be accessing those blocks after kmem_cache_alloc() reallocates those blocks. These readers are not going to take kindly to that memory being zeroed along the way. Therefore, add a WARN_ON_ONCE() complaining about __GFP_ZERO being passed to an allocation from a SLAB_TYPESAFE_BY_RCU kmem_cache.