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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 318E8C433F5 for ; Thu, 21 Oct 2021 14:10:03 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id BF64C6115B for ; Thu, 21 Oct 2021 14:10:02 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org BF64C6115B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 3570F6B0071; Thu, 21 Oct 2021 10:10:02 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 306CD6B0072; Thu, 21 Oct 2021 10:10:02 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1F7EA900002; Thu, 21 Oct 2021 10:10:02 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0172.hostedemail.com [216.40.44.172]) by kanga.kvack.org (Postfix) with ESMTP id 0FCD16B0071 for ; Thu, 21 Oct 2021 10:10:02 -0400 (EDT) Received: from smtpin19.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id A6D9A181F6E7F for ; Thu, 21 Oct 2021 14:10:01 +0000 (UTC) X-FDA: 78720628602.19.FCBAB5E Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by imf27.hostedemail.com (Postfix) with ESMTP id 16B8A700009B for ; Thu, 21 Oct 2021 14:09:58 +0000 (UTC) X-IronPort-AV: E=McAfee;i="6200,9189,10143"; a="209839094" X-IronPort-AV: E=Sophos;i="5.87,170,1631602800"; d="scan'208";a="209839094" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Oct 2021 07:09:51 -0700 X-IronPort-AV: E=Sophos;i="5.87,170,1631602800"; d="scan'208";a="495164630" Received: from xsang-optiplex-9020.sh.intel.com (HELO xsang-OptiPlex-9020) ([10.239.159.41]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Oct 2021 07:09:45 -0700 Date: Thu, 21 Oct 2021 22:29:37 +0800 From: Oliver Sang To: "Huang, Ying" Cc: Andrew Morton , 0day robot , Yang Shi , Zi Yan , Michal Hocko , Wei Xu , Oscar Salvador , David Rientjes , Dan Williams , David Hildenbrand , Greg Thelen , Keith Busch , Yang Shi , LKML , lkp@lists.01.org, feng.tang@intel.com, zhengjun.xing@linux.intel.com, dave.hansen@linux.intel.com, linux-mm@kvack.org, mm-commits@vger.kernel.org, torvalds@linux-foundation.org Subject: Re: [mm/migrate] 9eeb73028c: stress-ng.memhotplug.ops_per_sec -53.8% regression Message-ID: <20211021142937.GC16330@xsang-OptiPlex-9020> References: <20210905135932.GE15026@xsang-OptiPlex-9020> <87a6kbq4ek.fsf@yhuang6-desk2.ccr.corp.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87a6kbq4ek.fsf@yhuang6-desk2.ccr.corp.intel.com> User-Agent: Mutt/1.9.4 (2018-02-28) X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 16B8A700009B X-Stat-Signature: ie1rzy8i9grwpnzrm8b9zpq8fhzh4gf5 Authentication-Results: imf27.hostedemail.com; dkim=none; spf=none (imf27.hostedemail.com: domain of oliver.sang@intel.com has no SPF policy when checking 192.55.52.151) smtp.mailfrom=oliver.sang@intel.com; dmarc=fail reason="No valid SPF, No valid DKIM" header.from=intel.com (policy=none) X-HE-Tag: 1634825398-432144 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: hi, All, we confirmed this regression was fixed by commit: 295be91f7ef0027fca2f2e4788e99731aa931834 ("mm/migrate: optimize hotplug-time demotion order updates") https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git master the report link is: https://lists.01.org/hyperkitty/list/lkp@lists.01.org/thread/4KKRZ7CSIPKMD3Q43GZTGQXA6WBJM2XO/ On Fri, Sep 17, 2021 at 11:14:59AM +0800, Huang, Ying wrote: > Hi, Oliver, > > kernel test robot writes: > > > Greeting, > > > > FYI, we noticed a -53.8% regression of stress-ng.memhotplug.ops_per_sec due to commit: > > > > > > commit: 9eeb73028cfb54eb06efe87c50cc014d3f1ff43e ("[patch 174/212] mm/migrate: update node demotion order on hotplug events") > > url: https://github.com/0day-ci/linux/commits/Andrew-Morton/ia64-fix-typo-in-a-comment/20210903-065028 > > > > > > in testcase: stress-ng > > on test machine: 96 threads 2 sockets Intel(R) Xeon(R) Gold 6252 CPU @ 2.10GHz with 192G memory > > with following parameters: > > > > nr_threads: 10% > > disk: 1HDD > > testtime: 60s > > fs: ext4 > > class: os > > test: memhotplug > > cpufreq_governor: performance > > ucode: 0x5003006 > > > > Can you help to test whether the following patch can recover the > regression? > > Best Regards, > Huang, Ying > > ----------------------------8<-------------------------------------- > From 5d3e18a9f083954584932a20233ef489d9398342 Mon Sep 17 00:00:00 2001 > From: Huang Ying > Date: Thu, 16 Sep 2021 16:51:44 +0800 > Subject: [PATCH] mm/migrate: recover hotplug performance regression > > 0-Day kernel test robot reported a -53.8% performance regression for > stress-ng memhotplug test case. This patch is to recover the > regression via avoid updating the demotion order if not necessary. > > Refer: https://lore.kernel.org/lkml/20210905135932.GE15026@xsang-OptiPlex-9020/ > Fixes: 884a6e5d1f93 ("mm/migrate: update node demotion order on hotplug events") > Signed-off-by: "Huang, Ying" > Suggested-by: Dave Hansen > Reported-by: kernel test robot > Cc: Yang Shi > Cc: Zi Yan > Cc: Michal Hocko > Cc: Wei Xu > Cc: Oscar Salvador > Cc: David Rientjes > Cc: Dan Williams > Cc: David Hildenbrand > Cc: Greg Thelen > Cc: Keith Busch > --- > mm/migrate.c | 26 ++++++++++++++++++++++---- > 1 file changed, 22 insertions(+), 4 deletions(-) > > diff --git a/mm/migrate.c b/mm/migrate.c > index 77d107a4577f..20d803707497 100644 > --- a/mm/migrate.c > +++ b/mm/migrate.c > @@ -1145,6 +1145,8 @@ static int __unmap_and_move(struct page *page, struct page *newpage, > static int node_demotion[MAX_NUMNODES] __read_mostly = > {[0 ... MAX_NUMNODES - 1] = NUMA_NO_NODE}; > > +static bool node_demotion_disabled __read_mostly; > + > /** > * next_demotion_node() - Get the next node in the demotion path > * @node: The starting node to lookup the next node > @@ -1158,6 +1160,8 @@ int next_demotion_node(int node) > { > int target; > > + if (node_demotion_disabled) > + return NUMA_NO_NODE; > /* > * node_demotion[] is updated without excluding this > * function from running. RCU doesn't provide any > @@ -3198,13 +3202,26 @@ static void __set_migration_target_nodes(void) > goto again; > } > > +static int nr_node_has_cpu; > +static int nr_node_has_mem; > + > +static void check_set_migration_target_nodes(void) > +{ > + if (num_node_state(N_MEMORY) != nr_node_has_mem || > + num_node_state(N_CPU) != nr_node_has_cpu) { > + __set_migration_target_nodes(); > + nr_node_has_mem = num_node_state(N_MEMORY); > + nr_node_has_cpu = num_node_state(N_CPU); > + } > +} > + > /* > * For callers that do not hold get_online_mems() already. > */ > static void set_migration_target_nodes(void) > { > get_online_mems(); > - __set_migration_target_nodes(); > + check_set_migration_target_nodes(); > put_online_mems(); > } > > @@ -3249,7 +3266,7 @@ static int __meminit migrate_on_reclaim_callback(struct notifier_block *self, > * will leave migration disabled until the offline > * completes and the MEM_OFFLINE case below runs. > */ > - disable_all_migrate_targets(); > + node_demotion_disabled = true; > break; > case MEM_OFFLINE: > case MEM_ONLINE: > @@ -3257,14 +3274,15 @@ static int __meminit migrate_on_reclaim_callback(struct notifier_block *self, > * Recalculate the target nodes once the node > * reaches its final state (online or offline). > */ > - __set_migration_target_nodes(); > + check_set_migration_target_nodes(); > + node_demotion_disabled = false; > break; > case MEM_CANCEL_OFFLINE: > /* > * MEM_GOING_OFFLINE disabled all the migration > * targets. Reenable them. > */ > - __set_migration_target_nodes(); > + node_demotion_disabled = false; > break; > case MEM_GOING_ONLINE: > case MEM_CANCEL_ONLINE: > -- > 2.30.2 >