From patchwork Tue Jan 31 08:39:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Byungchul Park X-Patchwork-Id: 13122432 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 9329EC636CD for ; Tue, 31 Jan 2023 08:40:08 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D838C6B0080; Tue, 31 Jan 2023 03:40:01 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id C542F6B0081; Tue, 31 Jan 2023 03:40:01 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 87C2A6B007E; Tue, 31 Jan 2023 03:40:01 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 6D6DE6B0081 for ; Tue, 31 Jan 2023 03:40:01 -0500 (EST) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 4D58D1602B0 for ; Tue, 31 Jan 2023 08:40:01 +0000 (UTC) X-FDA: 80414446602.04.340909E Received: from lgeamrelo11.lge.com (lgeamrelo12.lge.com [156.147.23.52]) by imf21.hostedemail.com (Postfix) with ESMTP id 1D0FD1C0005 for ; Tue, 31 Jan 2023 08:39:58 +0000 (UTC) Authentication-Results: imf21.hostedemail.com; dkim=none; dmarc=fail reason="No valid SPF, No valid DKIM" header.from=gmail.com (policy=none); spf=softfail (imf21.hostedemail.com: 156.147.23.52 is neither permitted nor denied by domain of max.byungchul.park@gmail.com) smtp.mailfrom=max.byungchul.park@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1675154399; 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=J/LqlnG5zc04uMC4V9U7W+u/BW18Wd8gDOP8crsz6R4=; b=bB5grkK++QbOj4hV2tU7w2IVbNPaTLwaaAxuVc4r3YvtPoo2r1P17ZivRU2m9YWzNX4amL 5SHHpBKLnL2FlQFUBtIHkD1l24b6s9S61LYi8Syi6HZfYA+mY63BGxrSNcxLCEdgWkTcbF yqzWzH17rP+i2490pYV7lgSzoAxFgTo= ARC-Authentication-Results: i=1; imf21.hostedemail.com; dkim=none; dmarc=fail reason="No valid SPF, No valid DKIM" header.from=gmail.com (policy=none); spf=softfail (imf21.hostedemail.com: 156.147.23.52 is neither permitted nor denied by domain of max.byungchul.park@gmail.com) smtp.mailfrom=max.byungchul.park@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1675154399; a=rsa-sha256; cv=none; b=ViXDO35Phcg/dVPDes23DOlgphygXNfeDe7c1S7AuPVvvkNo1pOOQzLKoMOybmY0i9zTsq PWb8r5aIxYoOykd+pSMXmKcmRZ7u6dUgIHeIqcJat4ATI7l/gHjIKtMO9gu/wvIuf1xG+k z9miz7Tc2VYaGMscDJ9xBtzoO6sjX+8= Received: from unknown (HELO lgeamrelo04.lge.com) (156.147.1.127) by 156.147.23.52 with ESMTP; 31 Jan 2023 17:39:57 +0900 X-Original-SENDERIP: 156.147.1.127 X-Original-MAILFROM: max.byungchul.park@gmail.com Received: from unknown (HELO localhost.localdomain) (10.177.244.38) by 156.147.1.127 with ESMTP; 31 Jan 2023 17:39:57 +0900 X-Original-SENDERIP: 10.177.244.38 X-Original-MAILFROM: max.byungchul.park@gmail.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, max.byungchul.park@gmail.com, boqun.feng@gmail.com, longman@redhat.com, hdanton@sina.com Subject: [PATCH v9 08/25] dept: Apply sdt_might_sleep_{start,end}() to PG_{locked,writeback} wait Date: Tue, 31 Jan 2023 17:39:37 +0900 Message-Id: <1675154394-25598-9-git-send-email-max.byungchul.park@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1675154394-25598-1-git-send-email-max.byungchul.park@gmail.com> References: <1675154394-25598-1-git-send-email-max.byungchul.park@gmail.com> X-Rspamd-Queue-Id: 1D0FD1C0005 X-Rspamd-Server: rspam09 X-Rspam-User: X-Stat-Signature: 75km8kh6ijsddhpnrgqeiedzd6zykoo3 X-HE-Tag: 1675154398-750623 X-HE-Meta: U2FsdGVkX19IgCRglulUQ63C5l2J2OxIebZk6Ppol5BlWGc9fwcJun+xB3ElBx5HgzWx8QW8JD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pcfKKXGgEe1cVYhR/lgXzWIomiMjrLweTNzHSWNaQBczm4a/4xHyd4hqskfKYDiQgtWIVDbIS8e0xTqxJzbeeh77jTdTJxAGeNrkYoy5efj6tKTmooo5/PRoN2pJt5x/Om0u81st6nJnI+hR/BYrPGqJTfP8rlsbxL7V61PyYfUeq563otWHhyh+YIQBnd+QaiJMr/LHVNpDPQ3JEYrtPWwfIzzPYIB0QsdixUlWpA7XNyvkzImebjbBGX3AJBmII+duvGLz5vcYtKEKcgJEqEw0OiL+oyMRfeOKsHmexXJ6gJGP5HZaXcie0w0WgQsNvIbTZZQ3ljzWPLrGvPmw= 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: Makes Dept able to track dependencies by PG_{locked,writeback} waits. Signed-off-by: Byungchul Park --- mm/filemap.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/mm/filemap.c b/mm/filemap.c index c4d4ace..adc49cb 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -42,6 +42,7 @@ #include #include #include +#include #include #include #include "internal.h" @@ -1215,6 +1216,9 @@ static inline bool folio_trylock_flag(struct folio *folio, int bit_nr, /* How many times do we accept lock stealing from under a waiter? */ int sysctl_page_lock_unfairness = 5; +static struct dept_map __maybe_unused PG_locked_map = DEPT_MAP_INITIALIZER(PG_locked_map, NULL); +static struct dept_map __maybe_unused PG_writeback_map = DEPT_MAP_INITIALIZER(PG_writeback_map, NULL); + static inline int folio_wait_bit_common(struct folio *folio, int bit_nr, int state, enum behavior behavior) { @@ -1226,6 +1230,11 @@ static inline int folio_wait_bit_common(struct folio *folio, int bit_nr, unsigned long pflags; bool in_thrashing; + if (bit_nr == PG_locked) + sdt_might_sleep_start(&PG_locked_map); + else if (bit_nr == PG_writeback) + sdt_might_sleep_start(&PG_writeback_map); + if (bit_nr == PG_locked && !folio_test_uptodate(folio) && folio_test_workingset(folio)) { delayacct_thrashing_start(&in_thrashing); @@ -1327,6 +1336,8 @@ static inline int folio_wait_bit_common(struct folio *folio, int bit_nr, */ finish_wait(q, wait); + sdt_might_sleep_end(); + if (thrashing) { delayacct_thrashing_end(&in_thrashing); psi_memstall_leave(&pflags);