From mboxrd@z Thu Jan 1 00:00:00 1970 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B49B9C433EF for ; Thu, 4 Nov 2021 18:10:40 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 51CD3611EF for ; Thu, 4 Nov 2021 18:10:40 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 51CD3611EF Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id DD0906B006C; Thu, 4 Nov 2021 14:10:39 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D58DA6B0072; Thu, 4 Nov 2021 14:10:39 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BF9F96B0073; Thu, 4 Nov 2021 14:10:39 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0132.hostedemail.com [216.40.44.132]) by kanga.kvack.org (Postfix) with ESMTP id ADD826B006C for ; Thu, 4 Nov 2021 14:10:39 -0400 (EDT) Received: from smtpin27.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 6CEBA7532C for ; Thu, 4 Nov 2021 18:10:39 +0000 (UTC) X-FDA: 78772038198.27.2AC207D Received: from mail-pl1-f173.google.com (mail-pl1-f173.google.com [209.85.214.173]) by imf09.hostedemail.com (Postfix) with ESMTP id 095253000105 for ; Thu, 4 Nov 2021 18:10:38 +0000 (UTC) Received: by mail-pl1-f173.google.com with SMTP id p18so8528361plf.13 for ; Thu, 04 Nov 2021 11:10:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=VW9rfmaMJSEsWftJwhDxGcU8Jj1vspSpTDaU5NfJETo=; b=MaPalePSLwTVSLTQZ/NfHBIkV6TsAEfN77DIY9IuhEAGV6RnzMPu85cntU/7llPG/1 zgMV92evelYlCthYoAG9zoCga+N+zkMRNm8UfwDovFHmU/FUGFK9YvdmduF6R6X9mxWQ IsN27BI4O9jshC3h2hvm9eT6hYKMii1ApIQDxuQXnke/vxYC/kHsX228lxC6rVnqIOPa cD3OuSovX5qOrGO4JidyjkHDSe/6nTMi+5wHpoOWNyYujrcfHiqQC9xDxKs2VvV8CPTm RH8egQL+jJ2+A00vU1oSyBZCCmTSM1yVURINvOVMPXcDK/9Ils7PWpMCRJXZmy6b8FRh 0ZBA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=VW9rfmaMJSEsWftJwhDxGcU8Jj1vspSpTDaU5NfJETo=; b=T+FuA6RCwJ8Cbic9wGTP/wzBR+oex226Z9zBCjW7GrBTRuliyoeg8vAxl8vjQ9HszE mFB09epKpknqOyvufDhRf/h2pqctFjH6sKYhcfd4gtR0JBNVE9fILHxIYy0aLNrxqZcp jqInXvuylrQvXuIPZeoQFsQJQEj0qUFb0YFR9cKyXwO9ibSsgeH3rIaVzrquQ+VZpNBc WWWhWtQP1fiqhcYhu8zGjFO3+TQ2pDf0YKjpQ0lbZ3F8yLrZo9L8sWzVvGWgh5R/XaAt GWRVyElwX6rgvozKnPnxFeL0BQFLOdB2alvr5Z9Z9XpzwFD+YujDvyUySSbwDbRd0Or7 +W1g== X-Gm-Message-State: AOAM530zTqKYcSV8m90/JroueeLUwfUOMtDo8AEjiFFXLTYsuX6En7eE k77o1mVuwaj/fAqmheYIqGZ6b57ZdquKl5XTwh3vTg== X-Google-Smtp-Source: ABdhPJx/sGyzL9aB6E+j+NJ5u3H7kjEI1SCvA2LB3NJET6GXndw4NpuRSjOhAuw/+5pF9iMWMMfgZ64t89fyUW5Buuo= X-Received: by 2002:a17:902:b7cb:b0:141:b33a:9589 with SMTP id v11-20020a170902b7cb00b00141b33a9589mr38975386plz.9.1636049437562; Thu, 04 Nov 2021 11:10:37 -0700 (PDT) MIME-Version: 1.0 References: <20211103184708.1778294-1-jimmyshiu@google.com> In-Reply-To: From: Jimmy Shiu Date: Fri, 5 Nov 2021 02:10:25 +0800 Message-ID: Subject: Re: [PATCH] SCHED: attribute page lock and waitqueue functions as sched To: Matthew Wilcox Cc: mingo@redhat.com, joaodias@google.com, wvw@google.com, Minchan Kim , Will McVicker , Peter Zijlstra , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Daniel Bristot de Oliveira , Andrew Morton , David Howells , Vlastimil Babka , William Kucharski , "Kirill A. Shutemov" , Andreas Gruenbacher , linux-kernel@vger.kernel.org, linux-mm@kvack.org Content-Type: multipart/alternative; boundary="00000000000090823805cffa7170" Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=MaPalePS; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf09.hostedemail.com: domain of jimmyshiu@google.com designates 209.85.214.173 as permitted sender) smtp.mailfrom=jimmyshiu@google.com X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 095253000105 X-Stat-Signature: otjhc39uwnmnrm1yzht39m13s56pn87s X-HE-Tag: 1636049438-367491 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: --00000000000090823805cffa7170 Content-Type: text/plain; charset="UTF-8" On Thu, Nov 4, 2021 at 3:12 AM Matthew Wilcox wrote: > On Thu, Nov 04, 2021 at 02:47:03AM +0800, Jimmy Shiu wrote: > > +++ b/mm/filemap.c > > @@ -1271,7 +1271,7 @@ 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 inline int folio_wait_bit_common(struct folio *folio, int bit_nr, > > +static inline __sched int folio_wait_bit_common(struct folio *folio, > int bit_nr, > > It's not clear to me whether folio_wait_bit_common() needs to be marked > as __sched or whether marking its callers is sufficient, but I'm pretty > sure you forgot to mark put_and_wait_on_page_locked() as __sched, which > is an important one as it's now where we wait for readahead to finish > when reading a file. > I checked the implementation of arch/x86/kernel/process.c # get_wchan() . https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/x86/kernel/process.c#n972 Looks like it unwind the stack and find the 1st non-sched function. I think we should mark both folio_wait_bit_common() and put_and_wait_on_page_locked() --00000000000090823805cffa7170 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


=
On Thu, Nov 4, 2021 at 3:12 AM Matthe= w Wilcox <willy@infradead.org= > wrote:
On T= hu, Nov 04, 2021 at 02:47:03AM +0800, Jimmy Shiu wrote:
> +++ b/mm/filemap.c
> @@ -1271,7 +1271,7 @@ static inline bool folio_trylock_flag(struct fol= io *folio, int bit_nr,
>=C2=A0 /* How many times do we accept lock stealing from under a waiter= ? */
>=C2=A0 int sysctl_page_lock_unfairness =3D 5;
>=C2=A0
> -static inline int folio_wait_bit_common(struct folio *folio, int bit_= nr,
> +static inline __sched int folio_wait_bit_common(struct folio *folio, = int bit_nr,

It's not clear to me whether folio_wait_bit_common() needs to be mark= ed
as __sched or whether marking its callers is sufficient, but I'm pretty=
sure you forgot to mark put_and_wait_on_page_locked() as __sched, which is an important one as it's now where we wait for readahead to finish when reading a file.
I checked the implementation of=C2=A0<= /span>arch/x86/kernel/process= .c # = get_wchan() .=C2=A0<= /span>https://git.kernel.org= /pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/x86/kernel/process.c= #n972
Looks l= ike it unwind the stack and find the 1st non-sched function.
=
I= think we should mark both=C2=A0folio_wait_bit_common() an= d=C2=A0put_and_wait_on_page_locked()
--00000000000090823805cffa7170--