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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 878D3ECAAD3 for ; Thu, 1 Sep 2022 14:41:14 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E6CED8D0008; Thu, 1 Sep 2022 10:41:13 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id DF5D88D0006; Thu, 1 Sep 2022 10:41:13 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C6F2B8D0008; Thu, 1 Sep 2022 10:41:13 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id B131D8D0006 for ; Thu, 1 Sep 2022 10:41:13 -0400 (EDT) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 881CAA0FE4 for ; Thu, 1 Sep 2022 14:41:13 +0000 (UTC) X-FDA: 79863779226.06.8D46A92 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by imf19.hostedemail.com (Postfix) with ESMTP id 0ED2E1A003D for ; Thu, 1 Sep 2022 14:41:11 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id A05DC21A58; Thu, 1 Sep 2022 14:41:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1662043270; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=q4N85gBIGjjkFJw1wkwc5ynL7FFJex63BJvLcg0HCeA=; b=CJmILTtzWNnIHcZbFdvtuaob6Tl/IccFBow9lu5myxXMyqCFbxZkSWIhix8zjKuaMlVpvB qY+KrMMfTOdjmuinwaybfCD0QtNMRMoWA50VtutsryB4hr6Uu5LcP64wYuVhs8bUHPDI30 SU+staKJSRquCRcBzfSx5FYKxh2qJCM= Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 82DBE13A79; Thu, 1 Sep 2022 14:41:10 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id ntKrHYbEEGNwYwAAMHmgww (envelope-from ); Thu, 01 Sep 2022 14:41:10 +0000 Date: Thu, 1 Sep 2022 16:41:09 +0200 From: Michal Hocko To: Sebastian Andrzej Siewior Cc: linux-kernel@vger.kernel.org, Thomas Gleixner , Peter Zijlstra , Steven Rostedt , Linus Torvalds , Matthew Wilcox , Andrew Morton , linux-mm@kvack.org Subject: Re: [PATCH v2 3/8] mm/vmstat: Use preempt_[dis|en]able_nested() Message-ID: References: <20220825164131.402717-1-bigeasy@linutronix.de> <20220825164131.402717-4-bigeasy@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220825164131.402717-4-bigeasy@linutronix.de> ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1662043272; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=q4N85gBIGjjkFJw1wkwc5ynL7FFJex63BJvLcg0HCeA=; b=yWx6/j/+tHaF8pBt7B1J153ngWmYBodmVGTm2BCQNLLHMBg8bU1o+Ku45D9HKcQkrZ7qIW +m3EVaQNKAOoI0cDI7RCd63jL2nndKEKJyNrWV3DGQ0AE52jYJj1+PdRsPRD/amx9tAipy Iu29l+V0KyazLfjDylU9g+0MIU68Rl4= ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b=CJmILTtz; spf=pass (imf19.hostedemail.com: domain of mhocko@suse.com designates 195.135.220.28 as permitted sender) smtp.mailfrom=mhocko@suse.com; dmarc=pass (policy=quarantine) header.from=suse.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1662043272; a=rsa-sha256; cv=none; b=ciPLkV8+ymP5qF4YsbYsQ0LR1LaTCDLSL+KH3Cf7wQPrnKamCUnt+yBvM9Vr19zrjoAfuj YNVAEMT2BGie6UtMnSypx/nIqljpChsiVxvJRCJ1G+qk0CWa2fdIN0/ImNJkSzZ1i4X6F9 9MeoeiG/hnOB8BEz+Yge/Knzjs+IXwQ= Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b=CJmILTtz; spf=pass (imf19.hostedemail.com: domain of mhocko@suse.com designates 195.135.220.28 as permitted sender) smtp.mailfrom=mhocko@suse.com; dmarc=pass (policy=quarantine) header.from=suse.com X-Rspam-User: X-Stat-Signature: 6c18n9undmsjb1auwjr749t7xgysmq93 X-Rspamd-Queue-Id: 0ED2E1A003D X-Rspamd-Server: rspam05 X-HE-Tag: 1662043271-253676 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Thu 25-08-22 18:41:26, Sebastian Andrzej Siewior wrote: > From: Thomas Gleixner > > Replace the open coded CONFIG_PREEMPT_RT conditional > preempt_enable/disable() pairs with the new helper functions which hide > the underlying implementation details. > > Signed-off-by: Thomas Gleixner > Cc: Andrew Morton > Cc: linux-mm@kvack.org > Signed-off-by: Sebastian Andrzej Siewior > Acked-by: Peter Zijlstra (Intel) Acked-by: Michal Hocko Thanks! > --- > mm/vmstat.c | 36 ++++++++++++------------------------ > 1 file changed, 12 insertions(+), 24 deletions(-) > > diff --git a/mm/vmstat.c b/mm/vmstat.c > index 373d2730fcf21..d514fe7f90af0 100644 > --- a/mm/vmstat.c > +++ b/mm/vmstat.c > @@ -355,8 +355,7 @@ void __mod_zone_page_state(struct zone *zone, enum zone_stat_item item, > * CPU migrations and preemption potentially corrupts a counter so > * disable preemption. > */ > - if (IS_ENABLED(CONFIG_PREEMPT_RT)) > - preempt_disable(); > + preempt_disable_nested(); > > x = delta + __this_cpu_read(*p); > > @@ -368,8 +367,7 @@ void __mod_zone_page_state(struct zone *zone, enum zone_stat_item item, > } > __this_cpu_write(*p, x); > > - if (IS_ENABLED(CONFIG_PREEMPT_RT)) > - preempt_enable(); > + preempt_enable_nested(); > } > EXPORT_SYMBOL(__mod_zone_page_state); > > @@ -393,8 +391,7 @@ void __mod_node_page_state(struct pglist_data *pgdat, enum node_stat_item item, > } > > /* See __mod_node_page_state */ > - if (IS_ENABLED(CONFIG_PREEMPT_RT)) > - preempt_disable(); > + preempt_disable_nested(); > > x = delta + __this_cpu_read(*p); > > @@ -406,8 +403,7 @@ void __mod_node_page_state(struct pglist_data *pgdat, enum node_stat_item item, > } > __this_cpu_write(*p, x); > > - if (IS_ENABLED(CONFIG_PREEMPT_RT)) > - preempt_enable(); > + preempt_enable_nested(); > } > EXPORT_SYMBOL(__mod_node_page_state); > > @@ -441,8 +437,7 @@ void __inc_zone_state(struct zone *zone, enum zone_stat_item item) > s8 v, t; > > /* See __mod_node_page_state */ > - if (IS_ENABLED(CONFIG_PREEMPT_RT)) > - preempt_disable(); > + preempt_disable_nested(); > > v = __this_cpu_inc_return(*p); > t = __this_cpu_read(pcp->stat_threshold); > @@ -453,8 +448,7 @@ void __inc_zone_state(struct zone *zone, enum zone_stat_item item) > __this_cpu_write(*p, -overstep); > } > > - if (IS_ENABLED(CONFIG_PREEMPT_RT)) > - preempt_enable(); > + preempt_enable_nested(); > } > > void __inc_node_state(struct pglist_data *pgdat, enum node_stat_item item) > @@ -466,8 +460,7 @@ void __inc_node_state(struct pglist_data *pgdat, enum node_stat_item item) > VM_WARN_ON_ONCE(vmstat_item_in_bytes(item)); > > /* See __mod_node_page_state */ > - if (IS_ENABLED(CONFIG_PREEMPT_RT)) > - preempt_disable(); > + preempt_disable_nested(); > > v = __this_cpu_inc_return(*p); > t = __this_cpu_read(pcp->stat_threshold); > @@ -478,8 +471,7 @@ void __inc_node_state(struct pglist_data *pgdat, enum node_stat_item item) > __this_cpu_write(*p, -overstep); > } > > - if (IS_ENABLED(CONFIG_PREEMPT_RT)) > - preempt_enable(); > + preempt_enable_nested(); > } > > void __inc_zone_page_state(struct page *page, enum zone_stat_item item) > @@ -501,8 +493,7 @@ void __dec_zone_state(struct zone *zone, enum zone_stat_item item) > s8 v, t; > > /* See __mod_node_page_state */ > - if (IS_ENABLED(CONFIG_PREEMPT_RT)) > - preempt_disable(); > + preempt_disable_nested(); > > v = __this_cpu_dec_return(*p); > t = __this_cpu_read(pcp->stat_threshold); > @@ -513,8 +504,7 @@ void __dec_zone_state(struct zone *zone, enum zone_stat_item item) > __this_cpu_write(*p, overstep); > } > > - if (IS_ENABLED(CONFIG_PREEMPT_RT)) > - preempt_enable(); > + preempt_enable_nested(); > } > > void __dec_node_state(struct pglist_data *pgdat, enum node_stat_item item) > @@ -526,8 +516,7 @@ void __dec_node_state(struct pglist_data *pgdat, enum node_stat_item item) > VM_WARN_ON_ONCE(vmstat_item_in_bytes(item)); > > /* See __mod_node_page_state */ > - if (IS_ENABLED(CONFIG_PREEMPT_RT)) > - preempt_disable(); > + preempt_disable_nested(); > > v = __this_cpu_dec_return(*p); > t = __this_cpu_read(pcp->stat_threshold); > @@ -538,8 +527,7 @@ void __dec_node_state(struct pglist_data *pgdat, enum node_stat_item item) > __this_cpu_write(*p, overstep); > } > > - if (IS_ENABLED(CONFIG_PREEMPT_RT)) > - preempt_enable(); > + preempt_enable_nested(); > } > > void __dec_zone_page_state(struct page *page, enum zone_stat_item item) > -- > 2.37.2 -- Michal Hocko SUSE Labs