From patchwork Wed Feb 21 09:49:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Byungchul Park X-Patchwork-Id: 13565300 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 DF6EBC48BF6 for ; Wed, 21 Feb 2024 09:50:39 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 77E4E6B009E; Wed, 21 Feb 2024 04:50:07 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 6DF816B00A0; Wed, 21 Feb 2024 04:50:07 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 495AD6B009F; Wed, 21 Feb 2024 04:50:07 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 189A96B009D for ; Wed, 21 Feb 2024 04:50:07 -0500 (EST) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id E65F61A091C for ; Wed, 21 Feb 2024 09:50:06 +0000 (UTC) X-FDA: 81815340012.20.18BF5F2 Received: from invmail4.hynix.com (exvmail4.skhynix.com [166.125.252.92]) by imf11.hostedemail.com (Postfix) with ESMTP id 25EBC40010 for ; Wed, 21 Feb 2024 09:50:04 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf11.hostedemail.com: domain of byungchul@sk.com designates 166.125.252.92 as permitted sender) smtp.mailfrom=byungchul@sk.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1708509005; a=rsa-sha256; cv=none; b=7qInPNfl10HXFA6AS+tUhZraFdl7T7Dki95UVzVxbvrX0/d4BeQ0ZfD2eyd/jUCySzw4LA 4C+8KjtGBOpUfpYevVVdcdlEQ/bn5yr3jwYxZ3q5VYTMCMDOGQ+HOiqk3DIPzeag/r2bdy X9bb6QwJe3dUtbuum16HKhWNCLHCK6E= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf11.hostedemail.com: domain of byungchul@sk.com designates 166.125.252.92 as permitted sender) smtp.mailfrom=byungchul@sk.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1708509005; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:in-reply-to: references:references; bh=BFhoBMbkm4fdpwbPCyHPgkLbc5d+gjfBeXoXgdor0OY=; b=v0SO2Ai8bJMAS8tLl3pUb3IZEQG0PTil3XXthTnjXTHfs6RjwD5/tFcpdIDQGqlrMRk2mq Rvnt8JtYYvyW5h+p4LUr7mQoTFTwOkAviANDEUXG1X0gt/RFVC0lGNtHikxlVDjzxsIe0q QRA3zSbFEIPkoquLU8rgG1S7PvS9YFs= X-AuditID: a67dfc5b-d85ff70000001748-e8-65d5c73b25db From: Byungchul Park To: linux-kernel@vger.kernel.org Cc: kernel_team@skhynix.com, torvalds@linux-foundation.org, damien.lemoal@opensource.wdc.com, linux-ide@vger.kernel.org, adilger.kernel@dilger.ca, linux-ext4@vger.kernel.org, mingo@redhat.com, peterz@infradead.org, will@kernel.org, tglx@linutronix.de, rostedt@goodmis.org, joel@joelfernandes.org, sashal@kernel.org, daniel.vetter@ffwll.ch, duyuyang@gmail.com, johannes.berg@intel.com, tj@kernel.org, tytso@mit.edu, willy@infradead.org, david@fromorbit.com, amir73il@gmail.com, gregkh@linuxfoundation.org, kernel-team@lge.com, linux-mm@kvack.org, akpm@linux-foundation.org, mhocko@kernel.org, minchan@kernel.org, hannes@cmpxchg.org, vdavydov.dev@gmail.com, sj@kernel.org, jglisse@redhat.com, dennis@kernel.org, cl@linux.com, penberg@kernel.org, rientjes@google.com, vbabka@suse.cz, ngupta@vflare.org, linux-block@vger.kernel.org, josef@toxicpanda.com, linux-fsdevel@vger.kernel.org, viro@zeniv.linux.org.uk, jack@suse.cz, jlayton@kernel.org, dan.j.williams@intel.com, hch@infradead.org, djwong@kernel.org, dri-devel@lists.freedesktop.org, rodrigosiqueiramelo@gmail.com, melissa.srw@gmail.com, hamohammed.sa@gmail.com, 42.hyeyoo@gmail.com, chris.p.wilson@intel.com, gwan-gyeong.mun@intel.com, max.byungchul.park@gmail.com, boqun.feng@gmail.com, longman@redhat.com, hdanton@sina.com, her0gyugyu@gmail.com Subject: [PATCH v12 22/27] dept: Record the latest one out of consecutive waits of the same class Date: Wed, 21 Feb 2024 18:49:28 +0900 Message-Id: <20240221094933.36348-23-byungchul@sk.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240221094933.36348-1-byungchul@sk.com> References: <20240221094933.36348-1-byungchul@sk.com> X-Brightmail-Tracker: H4sIAAAAAAAAAzWSa0yTZxTHfZ732mqXNx3J3kGM0oTMYABxOE8sWfyg8zGL25TEJTiDVd6N KhfTKghqgliVi3RChDraKJfZVVoRWx1MqUOIIDilzMqYKUQbNiUWWcA2IqhrvXw5+eX/P+f3 6fCU8goTzWtz90i6XE22ipXT8okFDQnq3nvSMpc9GqqOL4Pgs1IaLBccLHha7Agclw5hGL+x Dv4KBRDM3h6gwFTjQdDwcISCSz2jCNy2Ehbujn0A3uAkC301FSwcbrrAwuCTOQy+2moMducG uHWiEUPnzCMaTOMsmE2HcXg8xjBjbebAWhwHflsdB3MPk6FvdIgB9/2l8NNpHwsd7j4aetr9 GO5esbAw6njNwK2emzR4qioZOP+0kYUnISsF1uAkB3921mNoNYRFR6dfMdBb2Ynh6M8XMXj/ vorgWukDDE7HEAvdwQAGl7OGghe/3EDgN05wcOT4DAfmQ0YEFUdqaRh42cuAwbcCZp9b2NWr SHdgkiIGVwFxh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k0EOyrIKEOQdO0ND1xcnA6b+BJj8VM6uSCRt /nGKmOqMpGmigib3q0Ryq3SAI6bmZxypsO8nddY4Uu3wYVL5PsAQe80Jltjfn+aIedSDyZjL xZF7ZydpMuIpwZtm/61YmixrNemy/o/luxTqrpsfmH2+yAMF3hGUiZwRZhTBi8IS8YL9Lgoz K8wXnz4NUmGOFuaKdfkvGDNS8JRwPFK0vn3ImhHP/yZIov/SwfAPLcSKtoFeHGal8KdYWdaA fjrniLXXW354IkL95TI/E+YoIUF83H2TKkSKCjStBkVrdOmpkkabsMiwR52h0xxYtHtvqh2F NmM5PFXUiD72rGlFAo9U05XqBo8cxUjphozUViTylCpaSRtDlTJZyjgo6/cm6fdrZUMrmsXT qhjlum3yrighRUqT98jyPln/64r5iJmZyLG6oLA3dzxytI9O/itGfacnbv3LtdtnbZE7SoOH ko5rQXruu59jzLtr7F4V+zq+ynTKqTtrnFc/1Cgve/S61JlypH1z1j8ujU0zt775xjv3WNvv J9KWNVzY+r+LJLmPrI9ZUv1kk2soh10p7bD2OS66dn7a4RhOnN0sm7suextTVLRBLS2Oo/QG 6TtCaSsnLwMAAA== X-CFilter-Loop: Reflected X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 25EBC40010 X-Stat-Signature: kgt3e4uh4kkbjszbgm5uqekhepmwsdiz X-Rspam-User: X-HE-Tag: 1708509004-217189 X-HE-Meta: U2FsdGVkX1/buuwwdoknUs7Os0V1R6118bb5sx6RzQcosPE82CDC/jq1vExAn7wQFhGfrUkr2ghqLEmLsXxmQpO7WP5Z68Ks6IsG0IzTTULjq/1Rutb9WubQWgLeIY74tLn8/H3gSbaVeitXC95oFeda+KOtSwaaJynWe+7siK4mlEPG8YKRPGUGZ8wtsEoRL/ZTxcMJr2ZXj9lallJdxw27XtzzMk6w7eZCN6TPQELWJ4BivfsS1QPLL50xCLlKAzpH4Be6vo9N7eMEwnRNpBZEWWUu/LgRlcVTRLebbzIsyFAtBMa5bP55GyaqUzpjSgiTKnRBAX4foQ4UaB65SA9Ydaf3hNxdTjkMzQ+lzCWOouk3FNJNSwdKSuSwdxDDfVb1ARBHAJgaHq9aURqWyTpBrTJE+Ger/mVqc/Dd2UfO9a0XTQ7oRgtkR5cUDa604cgJVtiW0mXPpyouqrWvEM/lT1lYDiLyyvzxOn/LV3dMNh29pG9M4qAfysucyPs5NkRCq63D9+ImT+KjP+ANcVx/H5IXVL/4GVIOzXbaOi+FgTzMFg1Balg6tcVkMiyU9u4EJDlRF+Ms7Oo3mhAjZ+JYwlgXue3faFMTvx2rV3jhOGuxvN5N+1VOX2A7Q/Mq0xB3CTcHejiDTBsiACbGVgZBPM3aPKleFo15F1LQ8RM6FU7tHef/QC7xCps5Spvn+Z4xViSRTNzKN2DbcKIC462P6ETAI1vkbKIx9Bm3XiRCeeT0T7MJBeoez+GwZsWJeQ0Syu0mNIi7iYTWGKJvdqrsJTqJw9hKGlssMjJ7hb6JjlwrRhi65inW47YuHn4su0vPHK0VNPSW0zXWbkMce/Ak0rqQd3JhIka/wW64Kx4IyNs1EmyaYUCgA9l+LV4feYSxeIQ0/pyyB5tE5C9TyaWnKWyB+xMHIpZsl2lepUgo03xBIOsjXWwMdVdER+9ExpX107MQjOsD5SPDBVD n4X7tO98 AWsmT3sAAWNtzSkMWAzcB7R3+ZYkp8m897YRcQiQBeGjdH7cWIzca8dmAMAKai50X0YOtsKN4aF6UF6mKzbBbjoH5F/h5W1tAOCZ6 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: List-Subscribe: List-Unsubscribe: The current code records all the waits for later use to track relation between waits and events in each context. However, since the same class is handled the same way, it'd be okay to record only one on behalf of the others if they all have the same class. Even though it's the ideal to search the whole history buffer for that, since it'd cost too high, alternatively, let's keep the latest one at least when the same class'ed waits consecutively appear. Signed-off-by: Byungchul Park --- kernel/dependency/dept.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/kernel/dependency/dept.c b/kernel/dependency/dept.c index 1b8fa9f69d73..5c996f11abd5 100644 --- a/kernel/dependency/dept.c +++ b/kernel/dependency/dept.c @@ -1521,9 +1521,28 @@ static struct dept_wait_hist *new_hist(void) return wh; } +static struct dept_wait_hist *last_hist(void) +{ + int pos_n = hist_pos_next(); + struct dept_wait_hist *wh_n = hist(pos_n); + + /* + * This is the first try. + */ + if (!pos_n && !wh_n->wait) + return NULL; + + return hist(pos_n + DEPT_MAX_WAIT_HIST - 1); +} + static void add_hist(struct dept_wait *w, unsigned int wg, unsigned int ctxt_id) { - struct dept_wait_hist *wh = new_hist(); + struct dept_wait_hist *wh; + + wh = last_hist(); + + if (!wh || wh->wait->class != w->class || wh->ctxt_id != ctxt_id) + wh = new_hist(); if (likely(wh->wait)) put_wait(wh->wait);