linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Joanne Koong <joannelkoong@gmail.com>
To: Shakeel Butt <shakeel.butt@linux.dev>
Cc: miklos@szeredi.hu, linux-fsdevel@vger.kernel.org,
	 jefflexu@linux.alibaba.com, josef@toxicpanda.com,
	linux-mm@kvack.org,  bernd.schubert@fastmail.fm,
	kernel-team@meta.com
Subject: Re: [PATCH v4 1/6] mm: add AS_WRITEBACK_MAY_BLOCK mapping flag
Date: Fri, 15 Nov 2024 11:33:08 -0800	[thread overview]
Message-ID: <CAJnrk1YmwRaMFZHzfLiHfXmVHeHdKmyR2027YpwN+_LS91YS6g@mail.gmail.com> (raw)
In-Reply-To: <CAJnrk1ZOc3xwCk7bVTKBSAh7sf-_szoSW-brEVx8e09icYiDDQ@mail.gmail.com>

On Mon, Nov 11, 2024 at 1:11 PM Joanne Koong <joannelkoong@gmail.com> wrote:
>
> On Fri, Nov 8, 2024 at 4:10 PM Shakeel Butt <shakeel.butt@linux.dev> wrote:
> >
> > On Thu, Nov 07, 2024 at 03:56:09PM -0800, Joanne Koong wrote:
> > > Add a new mapping flag AS_WRITEBACK_MAY_BLOCK which filesystems may set
> > > to indicate that writeback operations may block or take an indeterminate
> > > amount of time to complete. Extra caution should be taken when waiting
> > > on writeback for folios belonging to mappings where this flag is set.
> > >
> > > Signed-off-by: Joanne Koong <joannelkoong@gmail.com>
> > > ---
> > >  include/linux/pagemap.h | 11 +++++++++++
> > >  1 file changed, 11 insertions(+)
> > >
> > > diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h
> > > index 68a5f1ff3301..eb5a7837e142 100644
> > > --- a/include/linux/pagemap.h
> > > +++ b/include/linux/pagemap.h
> > > @@ -210,6 +210,7 @@ enum mapping_flags {
> > >       AS_STABLE_WRITES = 7,   /* must wait for writeback before modifying
> > >                                  folio contents */
> > >       AS_INACCESSIBLE = 8,    /* Do not attempt direct R/W access to the mapping */
> > > +     AS_WRITEBACK_MAY_BLOCK = 9, /* Use caution when waiting on writeback */
> >
> > To me 'may block' does not feel right. For example in reclaim code,
> > folio_wait_writeback() can get blocked and that is fine. However with
> > non-privileged fuse involved, there are security concerns. Somehow 'may
> > block' does not convey that. Anyways, I am not really pushing back but
> > I think there is a need for better name here.
>
> Ahh I see where this naming causes confusion - the "MAY_BLOCK" part
> could be interpreted in two ways: a) may block as in it's possible for
> the writeback to block and b) may block as in it's permissible/ok for
> the writeback to block. I intended "may block" to signify a) but
> you're right, it could be easily interpreted as b).
>
> I'll change this to AS_WRITEBACK_BLOCKING.

Thinking about this some more, I think AS_WRITEBACK_ASYNC would be a
better name. (AS_WRITEBACK_BLOCKING might imply that the writeback
->writepages() operation itself is blocking).

I'll make this change for v5.

Thanks,
Joanne

>
> Thanks,
> Joanne
>
> >
> > >       /* Bits 16-25 are used for FOLIO_ORDER */
> > >       AS_FOLIO_ORDER_BITS = 5,
> > >       AS_FOLIO_ORDER_MIN = 16,
> > > @@ -335,6 +336,16 @@ static inline bool mapping_inaccessible(struct address_space *mapping)
> > >       return test_bit(AS_INACCESSIBLE, &mapping->flags);
> > >  }
> > >
> > > +static inline void mapping_set_writeback_may_block(struct address_space *mapping)
> > > +{
> > > +     set_bit(AS_WRITEBACK_MAY_BLOCK, &mapping->flags);
> > > +}
> > > +
> > > +static inline bool mapping_writeback_may_block(struct address_space *mapping)
> > > +{
> > > +     return test_bit(AS_WRITEBACK_MAY_BLOCK, &mapping->flags);
> > > +}
> > > +
> > >  static inline gfp_t mapping_gfp_mask(struct address_space * mapping)
> > >  {
> > >       return mapping->gfp_mask;
> > > --
> > > 2.43.5
> > >


  reply	other threads:[~2024-11-15 19:33 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-07 23:56 [PATCH v4 0/6] fuse: remove temp page copies in writeback Joanne Koong
2024-11-07 23:56 ` [PATCH v4 1/6] mm: add AS_WRITEBACK_MAY_BLOCK mapping flag Joanne Koong
2024-11-09  0:10   ` Shakeel Butt
2024-11-11 21:11     ` Joanne Koong
2024-11-15 19:33       ` Joanne Koong [this message]
2024-11-15 20:17         ` Joanne Koong
2024-11-07 23:56 ` [PATCH v4 2/6] mm: skip reclaiming folios in legacy memcg writeback contexts that may block Joanne Koong
2024-11-09  0:16   ` Shakeel Butt
2024-11-07 23:56 ` [PATCH v4 3/6] fs/writeback: in wait_sb_inodes(), skip wait for AS_WRITEBACK_MAY_BLOCK mappings Joanne Koong
2024-11-07 23:56 ` [PATCH v4 4/6] mm/memory-hotplug: add finite retries in offline_pages() if migration fails Joanne Koong
2024-11-08 17:33   ` SeongJae Park
2024-11-08 18:56     ` David Hildenbrand
2024-11-08 19:00       ` David Hildenbrand
2024-11-08 21:27         ` Shakeel Butt
2024-11-08 21:42           ` Joanne Koong
2024-11-08 22:16             ` Shakeel Butt
2024-11-08 22:20               ` Joanne Koong
2024-11-08 21:59     ` Joanne Koong
2024-11-07 23:56 ` [PATCH v4 5/6] mm/migrate: skip migrating folios under writeback with AS_WRITEBACK_MAY_BLOCK mappings Joanne Koong
2024-11-07 23:56 ` [PATCH v4 6/6] fuse: remove tmp folio for writebacks and internal rb tree Joanne Koong
2024-11-08  8:48   ` Jingbo Xu
2024-11-08 22:33     ` Joanne Koong
2024-11-11  8:32   ` Jingbo Xu
2024-11-11 21:30     ` Joanne Koong
2024-11-12  2:31       ` Jingbo Xu
2024-11-13 19:11         ` Joanne Koong
2024-11-12  9:25   ` Jingbo Xu
2024-11-14  0:39     ` Joanne Koong
2024-11-14  1:46       ` Jingbo Xu
2024-11-14 18:19         ` Joanne Koong
2024-11-15  2:18           ` Jingbo Xu
2024-11-15 18:29             ` Joanne Koong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAJnrk1YmwRaMFZHzfLiHfXmVHeHdKmyR2027YpwN+_LS91YS6g@mail.gmail.com \
    --to=joannelkoong@gmail.com \
    --cc=bernd.schubert@fastmail.fm \
    --cc=jefflexu@linux.alibaba.com \
    --cc=josef@toxicpanda.com \
    --cc=kernel-team@meta.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=miklos@szeredi.hu \
    --cc=shakeel.butt@linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox