Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp5661373rwl; Sun, 8 Jan 2023 20:08:52 -0800 (PST) X-Google-Smtp-Source: AMrXdXu0D78ZfSXqFGS8v1QVUDWtbDys0uKIq2Xq9kfV0sfee2Ih3Ks/IEdsC3yatiUu5//CY5kD X-Received: by 2002:a17:902:dad2:b0:192:f5ba:6cdb with SMTP id q18-20020a170902dad200b00192f5ba6cdbmr22703557plx.66.1673237332376; Sun, 08 Jan 2023 20:08:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673237332; cv=none; d=google.com; s=arc-20160816; b=sv5u4mqvceI0L/vFTY8XCr/ZM8wQijmruzKEI0kK15s3ox0ukSaQ9hFHLbnXAsJson Y5hphVh7Uyv5rFoo0Yp/1P8z773RvePgQtuZizSiqa3U+P2tdMVmovRhza4ODC3g3wX3 FuTu5OCUPZ2yE7xhsu/DZhuzBLiADZi3liiw8PF+qjTeDBr01ruFZAdvdv7mkLrLodyN IGUpJ8lG1lwbA3ICP5+kAEf7YF3Y36PUvgxKUxlLbrs7DShcXtXLInNwQ0PPNLUQmMsE iUDC9xYGGW7r7rV84TAFyqzlPObaGBFtXVexLdY9c40NlIQHaWsw42u1DUAHCU7Qo5Gp 9ZeQ== 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=hop+8Cb2TKhkYHMGXre6eKhpq+NQ9XJo/jgM7qd/Kpc=; b=zu/ulfezbd7vZlIUbDXFz0pwxTxcS3fBXASOttzEcQB8EeBv8fm9mR7NMhY5vUH7W2 CNpbUHV4yRA/Kf6HkwzAC9iCFg8indPS/qCaluvxMKsBu9D3yhZoF0imzcb34oZRjAW7 ns/+iaRe7yGSDhZZVValdLW52gNeicyEQ9kFjmdp2pWJANXOR5zSR+zasyoBl1G4I8Ar tUTaodJaJmuZSXLNZr/KCcb+vUKSKWG4cJiOKMdIFRSfP8J3ly/AQ3/jTCYP7CVvyMnF +UXiipFGK2aFUyzCokOzqZiCKahfhTn6lKxN7boCnlVeCKhawQ4x7ZAlnqHakYJO/XU2 U68w== 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 k14-20020a170902c40e00b0018cfd25a8fasi10096251plk.214.2023.01.08.20.08.38; Sun, 08 Jan 2023 20:08:52 -0800 (PST) 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 S233961AbjAIEGi (ORCPT + 99 others); Sun, 8 Jan 2023 23:06:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55168 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236460AbjAIEEb (ORCPT ); Sun, 8 Jan 2023 23:04:31 -0500 Received: from lgeamrelo11.lge.com (lgeamrelo11.lge.com [156.147.23.51]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 2375311C38 for ; Sun, 8 Jan 2023 20:03:55 -0800 (PST) Received: from unknown (HELO lgemrelse6q.lge.com) (156.147.1.121) by 156.147.23.51 with ESMTP; 9 Jan 2023 12:33:54 +0900 X-Original-SENDERIP: 156.147.1.121 X-Original-MAILFROM: byungchul.park@lge.com Received: from unknown (HELO localhost.localdomain) (10.177.244.38) by 156.147.1.121 with ESMTP; 9 Jan 2023 12:33:54 +0900 X-Original-SENDERIP: 10.177.244.38 X-Original-MAILFROM: byungchul.park@lge.com From: Byungchul Park To: linux-kernel@vger.kernel.org Cc: 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 Subject: [PATCH RFC v7 23/23] dept: Record the latest one out of consecutive waits of the same class Date: Mon, 9 Jan 2023 12:33:51 +0900 Message-Id: <1673235231-30302-24-git-send-email-byungchul.park@lge.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1673235231-30302-1-git-send-email-byungchul.park@lge.com> References: <1673235231-30302-1-git-send-email-byungchul.park@lge.com> X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_NONE autolearn=unavailable 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 cd25995..9cd37b4 100644 --- a/kernel/dependency/dept.c +++ b/kernel/dependency/dept.c @@ -1521,9 +1521,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); -- 1.9.1