From patchwork Mon Jan 9 03:33:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Byungchul Park X-Patchwork-Id: 13092890 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 A79EEC54EBD for ; Mon, 9 Jan 2023 03:34:04 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id EA55B94000B; Sun, 8 Jan 2023 22:33:58 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id CF3388E0003; Sun, 8 Jan 2023 22:33:58 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 382A7900011; Sun, 8 Jan 2023 22:33:58 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 664A2900004 for ; Sun, 8 Jan 2023 22:33:57 -0500 (EST) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id DE44D1A0506 for ; Mon, 9 Jan 2023 03:33:56 +0000 (UTC) X-FDA: 80333841672.12.448C792 Received: from lgeamrelo11.lge.com (lgeamrelo11.lge.com [156.147.23.51]) by imf10.hostedemail.com (Postfix) with ESMTP id 40C92C000B for ; Mon, 9 Jan 2023 03:33:53 +0000 (UTC) Authentication-Results: imf10.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf10.hostedemail.com: domain of byungchul.park@lge.com designates 156.147.23.51 as permitted sender) smtp.mailfrom=byungchul.park@lge.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1673235235; a=rsa-sha256; cv=none; b=3bH8GniUG56LTEQockOBGxUVZXkHvS5QZaj6fL4J2XjESF78S8d1er4BuONEDEDkyYUOBh 5P3LH5eNCgCjmhTy5GSjIHHdunekd+GgeZTydif2UYEWVOF5G6+ZVXM4oC2NjKQHPDFGj7 JP50iqhXbaNGMs8FXHlof67hpmadLqs= ARC-Authentication-Results: i=1; imf10.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf10.hostedemail.com: domain of byungchul.park@lge.com designates 156.147.23.51 as permitted sender) smtp.mailfrom=byungchul.park@lge.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1673235235; 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=TinZD73qxjSTJuPS112w12TjlWYANcdNCj2VRw2UIqI=; b=8HALIZspMNlNgYKdzEg6rTBmihTqD9gkWujPHxJI6/vMqt279F4FisUoAuTAUD4tClb8Gt IbqN8G46KRw4t7dgfmnnzYsVPhIaNnSfvdRV3s+9zsNdkyodWbDhNIne4Ic/f/GYLaOrRc zcyQ9sLWLqS6ZK6u+OPNu0t5YzA7w/g= Received: from unknown (HELO lgemrelse6q.lge.com) (156.147.1.121) by 156.147.23.51 with ESMTP; 9 Jan 2023 12:33:52 +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:52 +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 08/23] dept: Apply sdt_might_sleep_strong() to PG_{locked,writeback} wait Date: Mon, 9 Jan 2023 12:33:36 +0900 Message-Id: <1673235231-30302-9-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-Rspam-User: X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 40C92C000B X-Stat-Signature: od54mhfxy9myfmqc5ysx398cm9typsgu X-HE-Tag: 1673235233-809005 X-HE-Meta: U2FsdGVkX1998fw4rEbpqLkKWl/oXmZuiTsgjD4Rnc77liDK9eeBdb8OyW8PQoSB8jJxGbK4Gow1NLRQWhyTsskWScoyQ4WwHuo34MmULy8eNd/JGC7jSko+kO+dKxZAJBiYf4Nae7VwcWUzlGwa8NmbvLAEH5Mg3H7JVaIvannY1kOv4wIyDtUiMW03kiXUkDB8S0JgGAC4ZrK95+8pIIxaskBhMAXSz0vHCyD74XdnCzyM2rKTu9nTsKbfEWLPRSxTvVGq5RVnK9CLsS4dLI4I1zoCJKUGJv5WMwuQxuuI82i04+6uBIx+M2O67Zf6oWL4llRY1Ezgf99Vm7cfkMbJDot/zS8A5n6pii1gJ9pQQYuZb6k7E/qcShIxg1obOW9vqGMKFdM2eKAHn4fvMdYFGvKOl4M4nq0JWGXvVI2HJgyZpeOaHeUCTp3AjWPWom+B+ly33kb9nP5lhgApn8TEmTuUAouGhImB6VHi322Me0uH0KBcOIEhmJrBspxWj2lKl2JVYtAb7k5B8n0fdbM6D9/5Ia6qeQK5kgEnMclVykm2Xfq3rzlt2APH1U4NCtmJ/5wjiKg4zXHn/JYrkSBcoXn88dinSuBBndNp6TK8k6vHKJwIBGN9QC6wVF9HjBmpci34h52aI4orPFdeYbCTarM1UcC/zX56/4X4clo2UYqHSAcn0wPCiRPEX8r3ULYdybQo81nL6DEa/QvzN9qk8L37rtivyTCPbzT3IhOnjTfD0FHj49lDf3sPIq+q2MNi97QhYdw2Z0O6nJJ9R/OuJll3MPS+gAU+QSpPK8rDGycYmyN5C3dLQODQg42cG4hO0qzd6CeBmNIc3FnkttKFk1aZiIjxrMBzemneQ6HdQpTCDaUWB1fjp+jIH7cb 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..b013a5b 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_strong(&PG_locked_map); + else if (bit_nr == PG_writeback) + sdt_might_sleep_strong(&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_finish(); + if (thrashing) { delayacct_thrashing_end(&in_thrashing); psi_memstall_leave(&pflags);