Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp5660444rwl; Sun, 8 Jan 2023 20:07:40 -0800 (PST) X-Google-Smtp-Source: AMrXdXvE1XPbzMw+Rrd4IAknUKY+6HlBe9d/sL1D248y10jU8MmS/8R5vWW2qGnBE2KIgassTRT1 X-Received: by 2002:a05:6a00:348a:b0:582:42a2:1d27 with SMTP id cp10-20020a056a00348a00b0058242a21d27mr33348245pfb.33.1673237260774; Sun, 08 Jan 2023 20:07:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673237260; cv=none; d=google.com; s=arc-20160816; b=flSFAf0esth5oIyKkG9zz7o0FJCLaBQo60dSW62LaqRTFbuPDlDWVLWQ3JBkRHJEBQ 51Xaas/AAc8SypeNJ89Yy4+c36Hg4xi5Ioo82F0kFJbbB6SAE7kyT1YR0bLLzEvGq8Kz 4f8F6CDWMRUsaMdckjfuNQXAqek5n4f1RKjjvSY/BY6JlTKQ0+JLB97X0Kk2jfU1+Vbk nwHlb7zHyYemCiP/BO9hHUmuEEfTo1aYF9eevaDZ1KRnaCKr/ZfUPQjIGQccAZk4NX6q ppPG4BVDi5KC8LeI2Lq9/bR9T9LDJrcQFW5oSNzqqxOt9E7Mc1+iWuwAZqFJj3Lm8OC3 wkSA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from; bh=TinZD73qxjSTJuPS112w12TjlWYANcdNCj2VRw2UIqI=; b=tNkv7dw7v830mszlBSaI+/3MLykWzO8f159QPSs2G/5RzG/6lrX15bgWXbtAUIKOzL qmyrWvb+g0+T+/Tt+BZrGE1wwB89CSyFy+Ay89hjJocYcR4rUoPEqiAGhakJsOdR4UOI WZC4P9LijpdU80+PJpS0L3d4iPpSHq0/+eWaiHZN7UdQI4lzL1EDa1ZLnoxbPB31U64I bhncYXz5tXEIF37drx5LP71hn7KA6m8plgIvAfpE4v1bl5NdqgzmJdMR6snXdNZxChC3 ru69KnrRxovBn7S3zZhi3YR0aIsLEswHKnyEiMVeISrflx8YYIpU6+UtLzGRmSgp2XsT 0LlA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b203-20020a621bd4000000b00580e559da3csi8121902pfb.202.2023.01.08.20.07.27; Sun, 08 Jan 2023 20:07:40 -0800 (PST) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236820AbjAIEFN (ORCPT + 99 others); Sun, 8 Jan 2023 23:05:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55018 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236513AbjAIEEO (ORCPT ); Sun, 8 Jan 2023 23:04:14 -0500 Received: from lgeamrelo11.lge.com (lgeamrelo11.lge.com [156.147.23.51]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 4A64711A12 for ; Sun, 8 Jan 2023 20:03:53 -0800 (PST) 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-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_NONE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org 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); -- 1.9.1