From patchwork Mon Jul 3 09:47:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Byungchul Park X-Patchwork-Id: 13299822 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 B2188C0015E for ; Mon, 3 Jul 2023 09:49:54 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BEE788E00A9; Mon, 3 Jul 2023 05:49:49 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B04408E00A8; Mon, 3 Jul 2023 05:49:49 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8930C8E00A5; Mon, 3 Jul 2023 05:49:49 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 497448E00A7 for ; Mon, 3 Jul 2023 05:49:49 -0400 (EDT) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 2306DAFBE0 for ; Mon, 3 Jul 2023 09:49:49 +0000 (UTC) X-FDA: 80969828898.11.FAA2775 Received: from invmail4.hynix.com (exvmail4.skhynix.com [166.125.252.92]) by imf01.hostedemail.com (Postfix) with ESMTP id 31F0B40006 for ; Mon, 3 Jul 2023 09:49:46 +0000 (UTC) Authentication-Results: imf01.hostedemail.com; dkim=none; spf=pass (imf01.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=1688377787; 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=76ZlSjTQRyEv4xWD34YwziPKu+07YKks+JZ/1/4qzKc=; b=ixa6K3DXtcjxFlMks+9Ww1GRTO2vN7i2LcLYrfxpHbRlV1sx2DmBOkW/rlE/pm9TTVnYbn Rp4XDO0per1qDpBj5CJE66UJzGEfZjMjBjpRjo+EPxTN0fJ1qZyo82cThHSwYlyhOjz6IG EiUDtxLmJ5o8CHo1OBfTCgYMR1mianA= ARC-Authentication-Results: i=1; imf01.hostedemail.com; dkim=none; spf=pass (imf01.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=1688377787; a=rsa-sha256; cv=none; b=heg4iZBxOiaXj+B82QxceL4GWeYcdifvMD7JqclQxk/dEUn4ecwENCeSCGp/dB9S2EbT/z ITDJzmlyNhKJKEtLSh5VIKUQ31X5o3Jp4fbPFXut+IhWKQxfjqngyoQrgu/ZF9srLP7UD1 pLd3LGKwoH5SV4MDh6A8pGA6Z9xoBwQ= X-AuditID: a67dfc5b-d85ff70000001748-56-64a299b25f73 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 v10 rebased on v6.4 08/25] dept: Apply sdt_might_sleep_{start,end}() to PG_{locked,writeback} wait Date: Mon, 3 Jul 2023 18:47:35 +0900 Message-Id: <20230703094752.79269-9-byungchul@sk.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230703094752.79269-1-byungchul@sk.com> References: <20230703094752.79269-1-byungchul@sk.com> X-Brightmail-Tracker: H4sIAAAAAAAAAzWSa0yTZxTHfZ732mr1TSXbKySoXcgSzVAZmBO8xJgsPl5jtsQPmmzr1nej GVTSAgJqBCmgyEUxWJHiSjG1gw5ZSxYRqR1G5BJqHQ1DU8koTMcEUbQotzFg8uXkl/M/5/fp z1PKW0w4r9WlSHqdOlHFymn5yDLrJ65yq2ZjxwAPFwo3QujNGRrMNxws+OpqETgasjEM3dsF f4wPI5jqekCBqcyHoKr/CQUNrX0Imu2nWegeXA7+0CgL7WXnWMipvsHCw+fTGAKXSjHUOvdD 53krBs/EMxpMQyxUmHLw3Pgbw4SthgNbVhQE7Vc4mO7fBO19PQw0P14P5VcDLNxubqeh9WYQ Q/ctMwt9jlkGOlvbaPBdKGLg5xdWFp6P2yiwhUY5+N1jwVBvnBPlvf6XgftFHgx5137B4H/U hMB95k8MTkcPC3dDwxhczjIKJq/fQxAsHuEgt3CCg4rsYgTnci/R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w8CLtDoMiXcrMJjfP0VQk/QB g6nMQqDBPoyh0pRNwXhRI4K+9K8sJKQ6WciNS0eQknCdhvapFwzEW31h4reB7NgiNAyPUEJ8 5Vmh2pFPCy8LeeHxzR5WiK/pZoV8U6RQWbxGuPNsEAsFo3ZGMJVcJYJpNIsVkr+asfCtrY0V mm9M0MInsx7vW3pYulUlhqijRM2G7YHSoNxpM3V6ShadZ1kVi6yuychFwnMb+enLrdQsE241 39XlnGM3bgVfmdbPJCOphOKuuPLF31+R2WIhp+GvPSifY5rz5PUDZmaWZZwvn1ozgf5Jl/Ol 5XVzIhfOj//8O30ul89srDk2koGk+WheCXJTh0WFKtUhvl7a4KCYMHW01/HwUBOa+RnjxcnM KjTW6V+POAlSzJd1nS9QyRlllDYmtB7xEkrhJtP13lbJZSplzDlRE35UExkiauuRh4RWLJHt OiAGyrmTyggxWBRPi5r/LZa4uMciv/TG/QG3kpOOuW4iHvd0207qd7/c6TEe0JyZMXXkuOWg 1DIaWes6vvbQqCEj/PHCgrbn9x0/lGeKzEubPT9uDi7dTVXUXlokum93rDrhIldPRjvsFyo2 Bp/I/Whpt833SVwmH+pPcFRtyMk65VjsjZ3h2oGpiF9vx1IO9p/rCfBfqaC1QUqfNZRGq/wL uvVjgC8DAAA= X-CFilter-Loop: Reflected X-Rspamd-Queue-Id: 31F0B40006 X-Rspam-User: X-Stat-Signature: 7c8xmukond9w3kpuizc4menqga9e1tw7 X-Rspamd-Server: rspam01 X-HE-Tag: 1688377786-331090 X-HE-Meta: U2FsdGVkX184je+r/KkIhkrInKxeXtA8vsABYjIfhBIXgIVMysRvqcSAFG5152ttdD32hA+nKOUxrDYAE7E84Yg9cvLvMxhQno3agAX/46CYVENCt8PMMTuMrluNExuL9Hz2IzG5sDR5/cJ3ZNUmTBBSIrlw/UKX1cFPWhyjkEAw6s24J0F0Lx/AGRkbV20XvbYACcp5WC5PKQadup0zU0oaFEeeNEeLkrUEJVemAk7YHWvNEZzde5I7xWDKb79tegGMny5xi05RswWzPlDB4V2Ple6utBiIxvYPBjKmZZNv2oq8BL5yyWD823JpSrQOF8FWzVPbctwmsx3tF72K/FMHGNq30JzqXks8SYCOi6Vbb+bLrVVXTutH0OzHjRxNybf8DgIMyKT/eZaHLkOhYOQqqazLdHaPhORkssg+RAdkEKT9COixweVj3FHBjkzuZi1EesfTAm4GZN418nZNOpqkZ2Dfol98I7kXgZjJftbMKgIHWkGITckqDTKs/SJ/ZxAWvuBdU08swe0WREHAyQ6ApUxzaom2cfIkraj4rmTZOo/YFlr2sx7fcwF3By4SwqKtmNxMHfhfyloOIwYRuR+xYxacI6tP+B8/eBIo/OsF68RlbX11kbGHqYxe5MiMWFJ9pkI+v6GzGsRyLzl+yGM4drqNXU0prpbYjmURx1cCXWksWMw3lhXQBu+t5ePeysQ7e63b32+z8zhlke/PQq06U5ycF+95HYrU3Na3RDrQm7lnoHWUr1+pzqa7y44nlQ4uZGJUI+UCIlcGRP6q8UfjI8rVoV3tN21H8PuizPE3IscP8/NHtzpRAUOn6xa8V5liJCj2wgJVIsADzRBdTlW+BtgQ0W+EUa1S6w7yyRO82d4xxZ3fyXWpJYYn0LCc+joITc/5/Zju9V2pW9up75rS5ucmLeKlQFtpwG3dDtDAhhC5br8PfYG4XlB6gwyKWGpRg5sR/qwOGCx+7jB FXCT0aTI LDwO2c+8uv1pJK/RL4Q6MBpdq6YYwXZ6KMGmT8pp9SH8IUap7cbTAp3PfkLW9Ti4cTYIlXwtDqhJCU6vKEfv5m3iY96TiStmkK+f+9yOg5eZ25IMxR/nwIYYIzskO3sT/15ftBMmZyvpNa5StJiB/A18zGxqJTl3J+a5S8z0yc0z0tkM= 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 83dda76d1fc3..eed64dc88e43 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -44,6 +44,7 @@ #include #include #include +#include #include #include #include "internal.h" @@ -1219,6 +1220,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) { @@ -1230,6 +1234,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); @@ -1331,6 +1340,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);