[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220827152745.3dcd05e98b3a4383af650a72@linux-foundation.org>
Date: Sat, 27 Aug 2022 15:27:45 -0700
From: Andrew Morton <akpm@...ux-foundation.org>
To: John Hubbard <jhubbard@...dia.com>
Cc: Jens Axboe <axboe@...nel.dk>,
Alexander Viro <viro@...iv.linux.org.uk>,
Miklos Szeredi <miklos@...redi.hu>,
Christoph Hellwig <hch@...radead.org>,
"Darrick J . Wong" <djwong@...nel.org>,
Trond Myklebust <trond.myklebust@...merspace.com>,
Anna Schumaker <anna@...nel.org>, Jan Kara <jack@...e.cz>,
Logan Gunthorpe <logang@...tatee.com>,
<linux-block@...r.kernel.org>, <linux-fsdevel@...r.kernel.org>,
<linux-xfs@...r.kernel.org>, <linux-nfs@...r.kernel.org>,
<linux-mm@...ck.org>, LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 2/6] block: add dio_w_*() wrappers for pin, unpin user
pages
On Sat, 27 Aug 2022 01:36:03 -0700 John Hubbard <jhubbard@...dia.com> wrote:
> Background: The Direct IO part of the block infrastructure is being
> changed to use pin_user_page*() and unpin_user_page*() calls, in place
> of a mix of get_user_pages_fast(), get_page(), and put_page(). These
> have to be changed over all at the same time, for block, bio, and all
> filesystems. However, most filesystems can be changed via iomap and core
> filesystem routines, so let's get that in place, and then continue on
> with converting the remaining filesystems (9P, CIFS) and anything else
> that feeds pages into bio that ultimately get released via
> bio_release_pages().
>
> Add a new config parameter, CONFIG_BLK_USE_PIN_USER_PAGES_FOR_DIO, and
> dio_w_*() wrapper functions. The dio_w_ prefix was chosen for
> uniqueness, so as to ease a subsequent kernel-wide rename via
> search-and-replace. Together, these allow the developer to choose
> between these sets of routines, for Direct IO code paths:
>
> a) pin_user_pages_fast()
> pin_user_page()
> unpin_user_page()
>
> b) get_user_pages_fast()
> get_page()
> put_page()
>
> CONFIG_BLK_USE_PIN_USER_PAGES_FOR_DIO is a temporary setting, and may
> be deleted once the conversion is complete. In the meantime, developers
> can enable this in order to try out each filesystem.
>
> Please remember that these /proc/vmstat items (below) should normally
> contain the same values as each other, except during the middle of
> pin/unpin operations. As such, they can be helpful when monitoring test
> runs:
>
> nr_foll_pin_acquired
> nr_foll_pin_released
>
> ...
>
> +static inline void dio_w_unpin_user_pages(struct page **pages,
> + unsigned long npages)
> +{
> + unsigned long i;
> +
> + for (i = 0; i < npages; i++)
> + put_page(pages[i]);
> +}
release_pages()? Might be faster if many of the pages are page_count()==1.
(release_pages() was almost as simple as the above when I added it a
million years ago. But then progress happened).
Powered by blists - more mailing lists