From: John Hubbard <jhubbard@nvidia.com>
To: Christoph Hellwig <hch@lst.de>, <john.hubbard@gmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Al Viro <viro@zeniv.linux.org.uk>,
Christian Benvenuti <benve@cisco.com>,
Christoph Hellwig <hch@infradead.org>,
Dan Williams <dan.j.williams@intel.com>,
"Darrick J . Wong" <darrick.wong@oracle.com>,
Dave Chinner <david@fromorbit.com>,
Ira Weiny <ira.weiny@intel.com>, Jan Kara <jack@suse.cz>,
Jason Gunthorpe <jgg@ziepe.ca>, Jens Axboe <axboe@kernel.dk>,
Jerome Glisse <jglisse@redhat.com>,
"Kirill A . Shutemov" <kirill@shutemov.name>,
Matthew Wilcox <willy@infradead.org>,
Michal Hocko <mhocko@kernel.org>,
Mike Marciniszyn <mike.marciniszyn@intel.com>,
Mike Rapoport <rppt@linux.ibm.com>, <linux-block@vger.kernel.org>,
<linux-fsdevel@vger.kernel.org>, <linux-mm@kvack.org>,
<linux-xfs@vger.kernel.org>, LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v4 1/3] mm/gup: add make_dirty arg to put_user_pages_dirty_lock()
Date: Thu, 1 Aug 2019 00:01:46 -0700 [thread overview]
Message-ID: <36713a8a-ac94-8af7-bedf-a3da6c6132a7@nvidia.com> (raw)
In-Reply-To: <20190801060755.GA14893@lst.de>
On 7/31/19 11:07 PM, Christoph Hellwig wrote:
> On Tue, Jul 30, 2019 at 01:57:03PM -0700, john.hubbard@gmail.com wrote:
>> @@ -40,10 +40,7 @@
>> static void __qib_release_user_pages(struct page **p, size_t num_pages,
>> int dirty)
>> {
>> - if (dirty)
>> - put_user_pages_dirty_lock(p, num_pages);
>> - else
>> - put_user_pages(p, num_pages);
>> + put_user_pages_dirty_lock(p, num_pages, dirty);
>> }
>
> __qib_release_user_pages should be removed now as a direct call to
> put_user_pages_dirty_lock is a lot more clear.
OK.
>
>> index 0b0237d41613..62e6ffa9ad78 100644
>> --- a/drivers/infiniband/hw/usnic/usnic_uiom.c
>> +++ b/drivers/infiniband/hw/usnic/usnic_uiom.c
>> @@ -75,10 +75,7 @@ static void usnic_uiom_put_pages(struct list_head *chunk_list, int dirty)
>> for_each_sg(chunk->page_list, sg, chunk->nents, i) {
>> page = sg_page(sg);
>> pa = sg_phys(sg);
>> - if (dirty)
>> - put_user_pages_dirty_lock(&page, 1);
>> - else
>> - put_user_page(page);
>> + put_user_pages_dirty_lock(&page, 1, dirty);
>> usnic_dbg("pa: %pa\n", &pa);
>
> There is a pre-existing bug here, as this needs to use the sg_page
> iterator. Probably worth throwing in a fix into your series while you
> are at it.
The amount of scatterlist code I've written is approximately zero lines,
+/- a few lines. :) I thought for_each_sg() *was* the sg_page iterator...
I'll be glad to post a fix, but I'm not yet actually spotting the bug! heh
>
>> @@ -63,15 +63,7 @@ struct siw_mem *siw_mem_id2obj(struct siw_device *sdev, int stag_index)
>> static void siw_free_plist(struct siw_page_chunk *chunk, int num_pages,
>> bool dirty)
>> {
>> - struct page **p = chunk->plist;
>> -
>> - while (num_pages--) {
>> - if (!PageDirty(*p) && dirty)
>> - put_user_pages_dirty_lock(p, 1);
>> - else
>> - put_user_page(*p);
>> - p++;
>> - }
>> + put_user_pages_dirty_lock(chunk->plist, num_pages, dirty);
>
> siw_free_plist should just go away now.
OK, yes.
>
> Otherwise this looks good to me.
>
Great, I'll make the above changes and post an updated series with your
Reviewed-by, and Bjorn's ACK for patch #3.
Next: I've just finished sweeping through a bunch of patches and applying this
where applicable, so now that this API seems acceptable, I'll post another
chunk of put_user_page*() conversions.
thanks,
--
John Hubbard
NVIDIA
next prev parent reply other threads:[~2019-08-01 7:01 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-30 20:57 [PATCH v4 0/3] mm/gup: add make_dirty arg to put_user_pages_dirty_lock() john.hubbard
2019-07-30 20:57 ` [PATCH v4 1/3] " john.hubbard
2019-08-01 6:07 ` Christoph Hellwig
2019-08-01 7:01 ` John Hubbard [this message]
2019-08-01 14:19 ` Jason Gunthorpe
2019-08-01 16:34 ` Christoph Hellwig
2019-07-30 20:57 ` [PATCH v4 2/3] drivers/gpu/drm/via: convert put_page() to put_user_page*() john.hubbard
2019-07-30 20:57 ` [PATCH v4 3/3] net/xdp: " john.hubbard
2019-07-31 6:08 ` Björn Töpel
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=36713a8a-ac94-8af7-bedf-a3da6c6132a7@nvidia.com \
--to=jhubbard@nvidia.com \
--cc=akpm@linux-foundation.org \
--cc=axboe@kernel.dk \
--cc=benve@cisco.com \
--cc=dan.j.williams@intel.com \
--cc=darrick.wong@oracle.com \
--cc=david@fromorbit.com \
--cc=hch@infradead.org \
--cc=hch@lst.de \
--cc=ira.weiny@intel.com \
--cc=jack@suse.cz \
--cc=jgg@ziepe.ca \
--cc=jglisse@redhat.com \
--cc=john.hubbard@gmail.com \
--cc=kirill@shutemov.name \
--cc=linux-block@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-xfs@vger.kernel.org \
--cc=mhocko@kernel.org \
--cc=mike.marciniszyn@intel.com \
--cc=rppt@linux.ibm.com \
--cc=viro@zeniv.linux.org.uk \
--cc=willy@infradead.org \
/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;
as well as URLs for NNTP newsgroup(s).