Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp16065515rwd; Mon, 26 Jun 2023 05:25:27 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5nEsF/IK0IGQAm20BQ1uaDKJEHUBRNukjqUhvopGEPWe0ewsLiuLnIWzJIf0aLkLdAby4u X-Received: by 2002:a17:902:cecf:b0:1af:cbb1:845 with SMTP id d15-20020a170902cecf00b001afcbb10845mr8648179plg.16.1687782326884; Mon, 26 Jun 2023 05:25:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687782326; cv=none; d=google.com; s=arc-20160816; b=puJHl73nLGaIEha9WSAGu4oKT25HvhmaNWrBmQXw1riNw+PlQ5VF+uYOD8sJ2E/sk9 Mr0n6PKUjvdPBtPZh1VGAM7CRv1yxfUiYEpiZKdcHQ2nP2zv1dwONPcIXvLxOih8En92 N0SAdUDSBCKc2UUabYq7PZKLh3XJ2oudZjRKsWFWACTEQ8EWq1Rs/Dw0yWahIQlBL3Da yLeqwo3jbuaxvlnsiILmyhrVkxe3QzLbEV7RU8IVE1S51HEy/TQ9cRU4JfgrfW07BO43 DwsJclTH727LsVlJXuwB6lMFrj70deU1N+s333WQ24x/g8CCNiew0/gNv+hY3h3gqHtV jgsA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from; bh=7VSmtydfVXVr/jsL1vG1bxg8h8ezelWaDitAIzEFS3w=; fh=XRjqVsBnH3A79ze0TZdn1GaMzocAY5TCjIrpk6ynN2Y=; b=HqYIv37pqfJWePcBHqa2uugNDIL6kT0o7pgFTb/iphnf+9VVP1+FKyUGAxKwZ/7EVD ySrg4wsuhG74TKzhFKbT3us0WpUd6VH1wuObDVlwX8PGWthe9fcLu0hEYvf2JYVp0wmZ nOl1Ym1iMeIlTdEiu12KEXnzE+0gzebL7a/Z3t4bs47QgCT9ny3a5RjnlUQ8zBAArvJ1 zh32L2f9CoYLTk2+F3zwQDILNegZxq72Yi8Kp1Y1Kn5kz59ykzmgU8ZTPbZ/LnzBuiav s8LVit7mr4hMJZj5V11QpnlwNrfoSXAdHGPVa0r515q8px79sdPu3mHaX4gZojS7kcsQ rbVg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q5-20020a170902c74500b001b682a513desi4513068plq.400.2023.06.26.05.25.13; Mon, 26 Jun 2023 05:25:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231138AbjFZMXD (ORCPT + 99 others); Mon, 26 Jun 2023 08:23:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54370 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230192AbjFZMWr (ORCPT ); Mon, 26 Jun 2023 08:22:47 -0400 Received: from invmail4.hynix.com (exvmail4.hynix.com [166.125.252.92]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id D76612D79; Mon, 26 Jun 2023 05:21:06 -0700 (PDT) X-AuditID: a67dfc5b-d85ff70000001748-17-64997d6e5ce2 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, paolo.valente@linaro.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 v10 23/25] dept: Record the latest one out of consecutive waits of the same class Date: Mon, 26 Jun 2023 20:56:58 +0900 Message-Id: <20230626115700.13873-24-byungchul@sk.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230626115700.13873-1-byungchul@sk.com> References: <20230626115700.13873-1-byungchul@sk.com> X-Brightmail-Tracker: H4sIAAAAAAAAAzWSa0hTYRjHe8/lPWfLyWHdThcqBhEVlXZ9oIj8EL0QURBR2Ie22kFXOmuW aRRYWth0lpJOTcpLLfGSNosuOllWpmWlqdNiWdnFtKlhznRbly3py8OP//95fp8enlbWsbN4 nf6IZNBrolRYzsgHggqX6k/makOqXDMgIy0E3CMpDORXlmNouVGGoPzWKQr6Hm+GzlEXAu/z lzSYs1oQFH54S8Othm4EtpLTGNo+BUO7ew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t160IKm6lYOh9EAnPB/sQjDx+QkB+ bhuCkrevCLjV0IXAXnaMhvb3fuD0uGlozj1JQ2rpDRqefh7F4Mo7g8FqWwct2WYMdUM9JOT3 0nAuPxV74yOGIUs5Axb9XOguK2Jg9G0oNHd1UFB/vpkC+8sgKLzgoqHG3kxCw+1uDO13i2no qvhNQUtDEwltOUYKrvWbafg8aCHA4nEz8KzOhKEyzWv7NGrHcPzbGAWNxjovXbqJwfmiGkFt xhsMtooOGuo9fRiqbLkEDF95gKA76wsD6aeGGDiXkoXgZHoeCU9+NVKQ5gqDkZ/F9Mpwob7P TQhpVfsE+6CJFB6aeeFO0StGSKt9yQgm216hqixQKK3pxULJgIcSbOWZtGAbOMMIhi9OLLg6 amihv7WVEZoKRsgNM7ZIw1VinDpJ1C5aHiWN+VBcQO3+MX6/8WktqUftEgOSsDy3mO8ZNmAf 09x8vrNziPCxPxfAVxk/UAYkZQmudDzf03SfMSCWncQp+bPuBN8Pyc3lK0s7kK+WcUt417VV /5SzeGtl3V+NxFtXPzIjH8u5MP6Yy0FnI6kJjStH/ur4JI1SHRcWrIuNSY5X7w/ekaCxIe9u LIdHc26j7+2RDsSxSDFBFjKzQCWnlEm6ZI0D8Syh8JdN/pmvkstUyuQDojZhu3ZvnKhzoOks qZgiW7tZjJJz0cpEMVYUd4va/1fMSqbpUezl00GujfMCLm1fmtsTYNfPOc7fjFrgrJfUpLQE XwkcHjP5rdjkMK+bmKhfvbMxepdk/td3+MhU/fCqkg3ZR4x7Ln4svKoJjzm0JvFgbeTsQEV/ Z9bR68Gh807cu+O6GzGhwW1C2yLSX2/J3GolWvdt6l5kUY85Dffzipb/sE40TJmqIHUxytBA QqtT/gH3/dofMwMAAA== X-CFilter-Loop: Reflected X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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-ext4@vger.kernel.org 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 52537c099b68..cdfda4acff58 100644 --- a/kernel/dependency/dept.c +++ b/kernel/dependency/dept.c @@ -1522,9 +1522,28 @@ static inline struct dept_wait_hist *new_hist(void) return wh; } +static inline 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); -- 2.17.1