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 3C35AC4708C for ; Tue, 6 Dec 2022 02:03:40 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4FC358E0002; Mon, 5 Dec 2022 21:03:39 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 485008E0001; Mon, 5 Dec 2022 21:03:39 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2FE728E0002; Mon, 5 Dec 2022 21:03:39 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 1D8568E0001 for ; Mon, 5 Dec 2022 21:03:39 -0500 (EST) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id D0FB01403F8 for ; Tue, 6 Dec 2022 02:03:37 +0000 (UTC) X-FDA: 80210234874.01.56A07E5 Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by imf05.hostedemail.com (Postfix) with ESMTP id 44FD5100018 for ; Tue, 6 Dec 2022 02:03:36 +0000 (UTC) Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=cv+6bakH; spf=pass (imf05.hostedemail.com: domain of ying.huang@intel.com designates 134.134.136.126 as permitted sender) smtp.mailfrom=ying.huang@intel.com; dmarc=pass (policy=none) header.from=intel.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1670292217; a=rsa-sha256; cv=none; b=fvH7G4Vupat3SfRR4FZuwuXceHCKct698oTd6qdt+2J5xQuL8JLGPAVMqpa4NLBl0NY1KI uEbwvlr6ObRNZee7iawO4YlT5TELu8aIyoPYrE1bJvVpc0g8scK9Md1mcbA9zMxYyUjYHY jPOmkACsn+C7MfFmPnQvCVll5YuaCVk= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=cv+6bakH; spf=pass (imf05.hostedemail.com: domain of ying.huang@intel.com designates 134.134.136.126 as permitted sender) smtp.mailfrom=ying.huang@intel.com; dmarc=pass (policy=none) header.from=intel.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1670292217; 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:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=JAYH6X7dhzMw5lJSGZ+H5t6f25iKWqjLfPqdIGZ5sPE=; b=keFCRKRfR6j+6q6Ub+Q1QkWImGyuucCVG3aYdb/brrl66Wbd6zdRPkbuksvreNXLlzEBcT bAWxLFqywUjJ++1Rhob8GIbXErNBuN4W8jcAOVirL/SN3u5kFij6o6VpjQ8sBT0YQB2E9D tm3cRtrLmnWIhlQhdfkMUSesNipbg5c= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1670292216; x=1701828216; h=from:to:cc:subject:references:date:in-reply-to: message-id:mime-version:content-transfer-encoding; bh=8c7UdCeE5P2gBTMsb1MwQl5B3qvTaC1WOOt1HdlBGyY=; b=cv+6bakH1rq7guUDioY7v684usil6vbkbjBBZ0dxOXkW1t+SS9WNBbjF ByxBnMh5zPbhfLVVfgr6ZQcU2qmuJ3pjDH4+uhz3ALJe/T4rQLlQnBhsm jNpwGA8ryZFJtJkBZmecOWo9rz2X93K7GBr3wuOTBljRq+N/1tqwCP/Ry MfUwsW3yv2uY2geFy84DIthgNMVVOLouLAtyH57Aeu2RdkqScgLBWgKEC js6nT+xFtknAVpGUKNh2T8wpCZLVy+74v2DkMxkCPKJdsftqp6aQzbeyk wHK0NLK3FYiGTyl32OqDphQPz4m1t43jaI9ZU1OCdTehLDuO8rndVQBhG A==; X-IronPort-AV: E=McAfee;i="6500,9779,10552"; a="299939462" X-IronPort-AV: E=Sophos;i="5.96,220,1665471600"; d="scan'208";a="299939462" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Dec 2022 18:03:34 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10552"; a="709474338" X-IronPort-AV: E=Sophos;i="5.96,220,1665471600"; d="scan'208";a="709474338" Received: from yhuang6-desk2.sh.intel.com (HELO yhuang6-desk2.ccr.corp.intel.com) ([10.238.208.55]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Dec 2022 18:03:31 -0800 From: "Huang, Ying" To: Linus Torvalds Cc: kernel test robot , oe-lkp@lists.linux.dev, lkp@intel.com, Andrew Morton , Johannes Weiner , Hugh Dickins , Nadav Amit , Linux Memory Management List , linux-arch@vger.kernel.org, feng.tang@intel.com, zhengjun.xing@linux.intel.com, fengwei.yin@intel.com Subject: Re: [linux-next:master] [mm] 5df397dec7: will-it-scale.per_thread_ops -53.3% regression References: <202212051534.852804af-yujie.liu@intel.com> Date: Tue, 06 Dec 2022 10:02:27 +0800 In-Reply-To: (Linus Torvalds's message of "Mon, 5 Dec 2022 12:43:37 -0800") Message-ID: <87ilipffws.fsf@yhuang6-desk2.ccr.corp.intel.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Rspam-User: X-Spamd-Result: default: False [-4.40 / 9.00]; BAYES_HAM(-6.00)[100.00%]; SUSPICIOUS_RECIPS(1.50)[]; SUBJECT_HAS_UNDERSCORES(1.00)[]; DMARC_POLICY_ALLOW(-0.50)[intel.com,none]; R_SPF_ALLOW(-0.20)[+ip4:134.134.136.126/32]; R_DKIM_ALLOW(-0.20)[intel.com:s=Intel]; MIME_GOOD(-0.10)[text/plain]; RCVD_NO_TLS_LAST(0.10)[]; MIME_TRACE(0.00)[0:+]; RCPT_COUNT_TWELVE(0.00)[13]; FROM_EQ_ENVFROM(0.00)[]; DKIM_TRACE(0.00)[intel.com:+]; RCVD_COUNT_THREE(0.00)[3]; TO_MATCH_ENVRCPT_SOME(0.00)[]; FROM_HAS_DN(0.00)[]; MID_RHS_MATCH_FROMTLD(0.00)[]; TO_DN_SOME(0.00)[]; ARC_SIGNED(0.00)[hostedemail.com:s=arc-20220608:i=1]; TAGGED_RCPT(0.00)[]; ARC_NA(0.00)[] X-Rspamd-Queue-Id: 44FD5100018 X-Rspamd-Server: rspam01 X-Stat-Signature: 13m59zwmsxf4a96mdfhsjxtuhnfebkfb X-HE-Tag: 1670292216-1941 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: Linus Torvalds writes: > On Mon, Dec 5, 2022 at 1:02 AM kernel test robot wr= ote: >> >> FYI, we noticed a -53.3% regression of will-it-scale.per_thread_ops due = to commit: >> 5df397dec7c4 ("mm: delay page_remove_rmap() until after the TLB has been= flushed") > > Sadly, I think this may be at least partially expected. > > The code fundamentally moves one "loop over pages" and splits it up > (with the TLB flush in between). > > Which can't be great for locality, but it's kind of fundamental for > the fix - but some of it might be due to the batch limit logic. > > I wouldn't have expected it to actually show up in any real loads, but: > >> in testcase: will-it-scale >> test: page_fault3 > > I assume that this test is doing a lot of mmap/munmap on dirty shared > memory regions (both because of the regression, and because of the > name of that test ;) I have checked the source code of will-it-scale/page_fault3. Yes, it exactly does that. > So this is hopefully an extreme case. > > Now, it's likely that this particular case probably also triggers that > > /* No more batching if we have delayed rmaps pending */ > > which means that the loops in between the TLB flushes will be smaller, > since we don't batch up as many pages as we used to before we force a > TLB (and rmap) flush and free them. > > If it's due to that batching issue it may be fixable - I'll think > about this some more, but > >> Details are as below: > > The bug it fixes ends up meaning that we run that rmap removal code > _after_ the TLB flush, and it looks like this (probably combined with > the batching limit) then causes some nasty iTLB load issues: > >> 2291312 =C4=85 2% +1452.8% 35580378 =C4=85 4% perf-stat.i.iTLB= -loads > > although it also does look like it's at least partly due to some irq > timing issue (and/or bad NUMA/CPU migration luck): > >> 388169 +267.4% 1426305 =C4=85 6% vmstat.system.in >> 161.37 +84.9% 298.43 =C4=85 6% perf-stat.ps.cpu-migr= ations >> 172442 =C4=85 4% +26.9% 218745 =C4=85 8% perf-stat.ps.node= -load-misses > > so it might be that some of the regression comes down to "bad luck" - > it happened to run really nicely on that particular machine, and then > the timing changes caused some random "phase change" to the load. > > The profile doesn't actually seem to show all that much more IPI > overhead, so maybe these incidental issues are what then causes that > big regression. 0.00 +8.5 8.49 5% perf-profile.calltrace.cycles-= pp.flush_tlb_func.__flush_smp_call_function_queue.__sysvec_call_function.sy= svec_call_function.asm_sysvec_call_function >From perf profiling, the cycles for TLB flushing increases much. So I guess it may be related? > It would be lovely to hear if you see this on other machines and/or loads. Will ask 0-Day guys to check this. Best Regards, Huang, Ying > Because if it's a one-off, it's probably best ignored. If it shows up > elsewhere, I think that batching logic might need looking at. > > Linus