From patchwork Mon Jun 26 11:56:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Byungchul Park X-Patchwork-Id: 13292769 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 D6BB1EB64DD for ; Mon, 26 Jun 2023 11:58:58 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E96BF8D0008; Mon, 26 Jun 2023 07:58:46 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E6D7A8D0005; Mon, 26 Jun 2023 07:58:46 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B87EF8D0008; Mon, 26 Jun 2023 07:58:46 -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 A14888D0005 for ; Mon, 26 Jun 2023 07:58:46 -0400 (EDT) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 593761A06A4 for ; Mon, 26 Jun 2023 11:58:46 +0000 (UTC) X-FDA: 80944752252.11.F0F3B3B Received: from invmail4.hynix.com (exvmail4.skhynix.com [166.125.252.92]) by imf12.hostedemail.com (Postfix) with ESMTP id 4DC404000E for ; Mon, 26 Jun 2023 11:58:43 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=none; spf=pass (imf12.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=1687780724; 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=LneQcjYWam7erajbXAnMaHyH4lCwHSIeexYxaiflgjM=; b=zgbB8j84uAMLayN17Mf2rCOwf0CExIkOHvecDojtvejizE/WHsMH6sBEe7PofA6g2UK114 +bOW+ItJQDMmkGHxdwrC5pH/meVP9ZzFV2h+yeaEzFV5h/aQ0LS1mEUROuacFq52bEMSWc G5WW0GgMgm33wr7rW3jvm+avbM2cJp4= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=none; spf=pass (imf12.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=1687780724; a=rsa-sha256; cv=none; b=ncLBYQCg61FMa/ZvIzLKiS0N24N1UEc++ZUUKtZUhQpROrRGFTsQV0Cuw40RkAcXMLLIZD HPQnvgrYUu+y0mz3tJZX5CxoEEbQFVrMfhH2mK3UBofqdjwDriNVu8z0YyaZVwMvtSI5Na 1ZyOpS8dAe5SjgLzzc2dngpr81hDC8Y= X-AuditID: a67dfc5b-d85ff70000001748-0f-64997d6bb058 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 08/25] dept: Apply sdt_might_sleep_{start,end}() to PG_{locked,writeback} wait Date: Mon, 26 Jun 2023 20:56:43 +0900 Message-Id: <20230626115700.13873-9-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: H4sIAAAAAAAAAzWSfUxTZxSH97733vdeCjU3Bd1VyDBNjBGVocHtJC5mCdHdJTPRbEuMxo/O 3o1KQW3la9OEj2IUKQqRFpGYUkxFwA+KS0Qp6ZBPGdhJUxlWMpiACEiGFi10aovxn5Mn53d+ z1+HoxROZgWnSTsm6dJUWiWR0bLpiKr12hMX1AktHZFQUpQAvlenaKi8UU/Adb0OQf2tXAwT 7d/Ao7kpBAu9Dygwl7kQVA0/oeBWxxACR00egf6nS8DtmyHQXXaGQH71DQJ/TQYweE2lGOrs 26HnnBWD0z9Og3mCwEVzPg6OZxj8tloWbDmrYKSmgoXA8AboHvIw4BhcCxcueQk0O7pp6Lg9 gqH/TiWBofp3DPR0dNHgKjEycO2FlcDknI0Cm2+GhYdOC4abhqDoecCB4eTLtwx0Gp1ButyA wf33XQQtp/7BYK/3ELjnm8LQaC+jYP5KO4KR4mkWCor8LFzMLUZwpsBE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I2GbCLgqOP3/NwlVz Z4R+/5OC0VsdCK6cuEeB1DiGoTvgp6BVKqPh5R+9CHynn3BQWBLi4MKx0whOFZYzMPzqKgsF XjXMz1nxlk2k2z9Lk4LWg8QVtDHkml0gf1ff5UjBldscsUkHSGtdPKl1TlOk5lmAJVL9SUyk Z6UcKX4yShHvmBOTp0NDHOmvnGd2fPyTfJNW1OuyReO6zSny1EHPQ5wZVhw6f6Yc56I7scUo Ribw64Wph3YcZcx/Jty8GaKjHMd/IrSa/2OLkVxG87WxwlR/DxctFvK/CPc9IyjKDL9aGPRb qCgreLXwsrwS/S9dKTS0dL4TxfAbhI4B+7tcGdnkebvwWSS3oQ/qUZzOkJ2u0enVCaa01ByD 7lDCrxnpEop8juNI2NKOXoxs60K8DKkWKBJXVGqVrCbblJPehQQZrYpTLJ6r0CoVWk3OYdGY scd4QC+autBHMka1RLH9ezFFye/TZIlpopgpGt+3lCxmWS4aSFYHDUf/muxJWOw7Gbtf/vMi 5L+03rrUuXtjafV3w+Z17r13JGeob3NvyhqDNZ7ZRWe0+7L5zMPNs492fpHfFDTua1k18+kc tlUWZZKU2sRdWR2K5EmlPrnwR3fJD2vZ0f1Q8vXMraI9XE2b2Zen3hrbU5Q1d2m5pVSQTP5z KsaUqkmKp40mzVu761OUNQMAAA== X-CFilter-Loop: Reflected X-Rspamd-Queue-Id: 4DC404000E X-Rspam-User: X-Stat-Signature: 6ejqtjifuqc56qcy3y64termqsgdi9kk X-Rspamd-Server: rspam01 X-HE-Tag: 1687780723-532201 X-HE-Meta: U2FsdGVkX18j57AldmRmUh9sIFl/IlnidWdqXsd/OpNiSOY1tcA9tkEaENP+Aq8xUD4e770DSODq/OmTBeHyntTBuo4Ydw38Ui/O3E+BrGecbL9/a9umfkiMi+JxNsp0DF5flN7FmnIoeHt3NWpXOrUy4xJnsgkQMZBKe4cYqIg3mXg/23vunIgZOsnY3qn/JqEdZ6Ww8XVgu6GhkMD7tEwzU+vqXF2v172I58/Q2ARPBmlN4pgUgoX5ZVPLO/a7NPu11LXwix8ML07SOIaWBZWsz1qHBcFjjPtMp6U/NM7QJz0udy50XXtbKXZd6Q7dRpcN/SuE6ipKn++VR/PMVwrMdnOb541Y0H7FGC/dO9sYPPcgCtgW0q5/xppOOMkE+fldyLPMhOKdLsq4B7TdS+RrNiLI9Ghk0Ouz+nXLc9LQEDEyMLx8VECtmD5M1VtU+8i+EOnkCUf6ImaNQd9Gmixzw3PLtt/mvJPG2FXmn+/O5jKUXHVTc2+uExuPqLTe8geyBNo3IdkktHQEC0S8hzUUbaPSABhysNc63REPv0Y2s+W/Xx/GXhUcyfkLYzetw/VM4lsSTVKv9vcottEfGCpLYTM7YiVa54qlMkM6TpyCA0j0FQLwxkBltonipsQ5ssZ27SJsJiSyixjrHRl0PRr92OwqSm3aGLTMTSssgJ534vecaY6llaYar/cJQTdKwrr5FJgyJsxhuf+NBMIpgUk/3tRaASyeeGzZ1hGMOvBZng4p2gY4Z56DQknBUGe1HUDRtQDTXggMgOPi6zZ3QUDI46Bbl0dTsuulaOp2TEh0WINXObITeoOnbjmWGw6Y0A9QbrFEUeC5gcA6tWlwez3vPaNC3aXFvbXDEIThc3EckiWMxl396z8xVfCCERv5UfOtXTbHaCFXCjcwZxz+3lpaToGMoYTg2oHfsHOhFp2GATuY5eRItnC1Y/cGAgKjHRo8ruNenNS5WOyjCuM XpFWrhgO YavkZq6tJbEkL3E8s5jy4VuazHXBFyyXbne5osO50+ClVevGxBiXXrxwV1qQXYtBg9eIAxPyeSuFTxEeJGa8nGGYf4ni5wF5Xobaizq05xuJGLvBUZj4zyKqsUcvnWJr6wJw9rhZwzHrsNpkuypisaCLaHWzbskTaDI7ghqD4n0g4JuI= 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 c4d4ace9cc70..adc49cb59db6 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);