From patchwork Wed May 8 09:47:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Byungchul Park X-Patchwork-Id: 13658331 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 3BD10C04FFE for ; Wed, 8 May 2024 09:48:10 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 022066B00E6; Wed, 8 May 2024 05:47:53 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id F13CD6B00E5; Wed, 8 May 2024 05:47:52 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D19436B00E9; Wed, 8 May 2024 05:47:52 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id AAF606B00E6 for ; Wed, 8 May 2024 05:47:52 -0400 (EDT) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 72DAF1C11D3 for ; Wed, 8 May 2024 09:47:52 +0000 (UTC) X-FDA: 82094751984.12.60CE6E4 Received: from invmail4.hynix.com (exvmail4.skhynix.com [166.125.252.92]) by imf09.hostedemail.com (Postfix) with ESMTP id 9583614001B for ; Wed, 8 May 2024 09:47:50 +0000 (UTC) Authentication-Results: imf09.hostedemail.com; dkim=none; spf=pass (imf09.hostedemail.com: domain of byungchul@sk.com designates 166.125.252.92 as permitted sender) smtp.mailfrom=byungchul@sk.com; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1715161670; 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=ZmLcd3ZIMOKX8ggeE+B9Oo44uSzYto5RlIRdDwKyyYM=; b=JctKF4i/u1WDLdaGetQsNGq/lrIqSH/41ummMo7NC/K52Ts0W1W7zRh5gCTs4NU8OM3WLY FcreAvlwFYD4ZlzAuN4JkLmJ3rZJCpIBrNzzYiO5RaMmA8Xw6lSA1TrAJQSWz0qbpc56LI VHGiZft59eaEZGRUKBW1ovOLQjV9zlo= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=none; spf=pass (imf09.hostedemail.com: domain of byungchul@sk.com designates 166.125.252.92 as permitted sender) smtp.mailfrom=byungchul@sk.com; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1715161670; a=rsa-sha256; cv=none; b=PV8Xug5EPl5aQQOPC6fAYj1RW59vFoRwMX04+C4ACbyFHlLLy7cW5ruWLQ45p5kXScuoM/ 69KSKbQu3LlpZOF135DeVRO7/D5ha20ISsitTFEHGJheqbeA6OzkXJafFhmv2Y6XzH9Dtk yrJAoSaXDPJoxzLD/ZZf5kGXWdoScnQ= X-AuditID: a67dfc5b-d85ff70000001748-b5-663b4a39aaa4 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, 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 v14 10/28] dept: Record the latest one out of consecutive waits of the same class Date: Wed, 8 May 2024 18:47:07 +0900 Message-Id: <20240508094726.35754-11-byungchul@sk.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240508094726.35754-1-byungchul@sk.com> References: <20240508094726.35754-1-byungchul@sk.com> X-Brightmail-Tracker: H4sIAAAAAAAAAz2Sf0iTeRzH+36f7/PD5eJhLXzS6LpRCUn2y+pz1kVwdPdQCEV/BN1ZjXxs q/mDbWoWxcppZi0sUC+VUqu11LtsWqipLMOlSbpypJZZSZxnbQp6Gy2lbjPqnw8vPp/35/XX m6MUd+lITptqlPSpap2KkRGZN7xyZfz2TcmrbwwSuHh+Nfj+yydQfruWAdffNQhqG05hGOv4 Dfr9HgTTT3opKClyIah8+4qCBucwglbbaQb63s0Dt2+Cga6icwzkXLvNwNMPMxiGii9hqLEn QHdhFQZHYJRAyRgDZSU5ODj+xRCwVrNgNS2DEVspCzNv10DX8HMaWl/EwOUrQwy0tHYRcDaO YOhrLmdguPYLDd3OTgKuixYa/hqvYuCD30qB1TfBwjNHBYY6c1CUN/WZhkcWB4a863cwuAfv I2jLf4PBXvucgYc+D4Z6exEFn252IBi54GUh93yAhbJTFxCcyy0mYB5aD9Mfy5mtP4kPPROU aK7PElv9FUR8XCWITaWvWNHc9oIVK+wZYr1thXitZQy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AdK6Q3ruMbXcMEb7An846R IpJ/VszxD/J7Gd5Q183wRbZE3l62nC95OID5m988FG8rP0/ztm8XGT5rqAPz7tZWhn96xUvy HzrMeFfAflnkIVGtShK1qzbEyOLyBl+gYwPTTzx/4CZT0RNpFpJKODaMe3y7C/mYZpdyXV3j hI/92IWcPecT5WOCdcm4W61bfDybFbia6pGpPcku4UrrxrCP5exqrnCwgPrnDOQqquqnPNLJ /M1n99RewYZztfp8Jg/JitC0cuSn0iTFCyp1eLDuSFyKRnUi+ODReBuafBfL6QljNfrRHtWA WAlSzpC30RGxCkpI0qXENyBOQij95E3n1sQq5IeElJOi9ugBbaJa1DWgAAmpnCvftk+MUbCH hQTxiCgeE7X/WyyR+qeiTOFMSfCfOKMqa8XonI+nvldR/frF1cmmqMzrbxfE722JDvKwlfcc ge+HNq1d3x5ZWaP+ZXyU4K3NXe8ecuYELly2fdaVyLAM+aWQRaR72SxNZ9jMeZf25Fk97jMh nTV9MVdDpW7T5tGtVfO9ErPn+LOdMbuz/e2lFr/B0AAvdyNISerihNDlhFYn/AXpFhxPKgMA AA== X-CFilter-Loop: Reflected X-Rspamd-Queue-Id: 9583614001B X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: cxbc8tgp6quatpmsmc1nnd9t8dxwmjye X-HE-Tag: 1715161670-990070 X-HE-Meta: U2FsdGVkX191l1U7gDBTtg0ZEi2Aq4D3TN7uvd1X/Sp8eAnZNZPmxG7oWzZwQzoml4RGBlk/kDBlBlPYDgmAUC91farDLdh/PFdi2m6OewrLdRc9szpCX6yQNbRg8dCIPhMSCgM1Wx1OZrY7X6aVqwUzDrxLbwbBFOLtZmQk2+dvX7MO82+3NImxFVU+4K125nQ5UZHEgxkhV/RmgOHQenWmF1K7zXp9GSXd2P+Clirn9GpPihVAeFdUVHkZEvCCtqVn7tqO3zvesIxwYEi30Iwy30EYCRfSiJn696WMavB7cxqR33qHZ+nKPpSr6mY5EEoyRG6wuixTk5jLLD6koCY4Fq6/o6lhRSQEC8Bm6i/Cc258pPthRI3X9f8o53R1jzFEQB1G2oyGV9/bYpmbGAYQRKKFw75LNmFXeIRG3L+lUAAZ5WQSICTGD4VnmBnBOZBqN+mMhFWMz148pk9lhQ1sB86zQ96oGD4n/Sy4DHz/IHCXHb6+N/JSHtFI38Ie8WFCC5MAiYGJZn8GdlUTqwKXDj6NSnQYyjlV4C97Wp2LSVe1C09tNwYiUhq75n9s+8xmPcPH5QLLLUXK2g5rMwPOFVVGFW1czdROlXr3XQYivW1kUTwHaOd7vApgeNI6gDpbBboyLsBhNjLZRnn+2GsKSEH7lvHzjrZDizHel96pMKjieZHlmwsU9E205WL0bSjHQP6mkobY+1Xt4zTXQ9jph0f8V7lK8iyklj+VMyJjeGNO0XV7tMk0+G33N+AKO9EXYRgzGNTSNLesxaK5W/BLOuF9rAr5GiayJS4y2v7dVBsTNBx/qqwsCSQb3JyVoJdIPfQh9IxCINym/69TACUhmpP1867fT4nQrSFiFnC8DxV4g2sHMQTfjDYDvE0z+ZPNWHkHlLs4YAbpg60GglwEydJvVVYMG9zq5e4GhRo5yj7cp4hlspqAA5J9lRAA/CmiurYWX8H2e+RRrk1 smh8x5Q+ f9Q5Swjq7sr9UjHAYSoSdDxIi0U6mulJ4foVaZtosKqOcZZXsbe87AJzFnJzFdT9ohBpvfgSQ5hlrojkZLpF4M/bNvBFXVu+6eefSjGI8FQ8w13m0VPjkxTJA9gEMTuwE4M3B 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 8ca46ad98e10..2c0f30646652 100644 --- a/kernel/dependency/dept.c +++ b/kernel/dependency/dept.c @@ -1497,9 +1497,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);