[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <36713a8a-ac94-8af7-bedf-a3da6c6132a7@nvidia.com>
Date: Thu, 1 Aug 2019 00:01:46 -0700
From: John Hubbard <jhubbard@...dia.com>
To: Christoph Hellwig <hch@....de>, <john.hubbard@...il.com>
CC: Andrew Morton <akpm@...ux-foundation.org>,
Al Viro <viro@...iv.linux.org.uk>,
Christian Benvenuti <benve@...co.com>,
Christoph Hellwig <hch@...radead.org>,
Dan Williams <dan.j.williams@...el.com>,
"Darrick J . Wong" <darrick.wong@...cle.com>,
Dave Chinner <david@...morbit.com>,
Ira Weiny <ira.weiny@...el.com>, Jan Kara <jack@...e.cz>,
Jason Gunthorpe <jgg@...pe.ca>, Jens Axboe <axboe@...nel.dk>,
Jerome Glisse <jglisse@...hat.com>,
"Kirill A . Shutemov" <kirill@...temov.name>,
Matthew Wilcox <willy@...radead.org>,
Michal Hocko <mhocko@...nel.org>,
Mike Marciniszyn <mike.marciniszyn@...el.com>,
Mike Rapoport <rppt@...ux.ibm.com>,
<linux-block@...r.kernel.org>, <linux-fsdevel@...r.kernel.org>,
<linux-mm@...ck.org>, <linux-xfs@...r.kernel.org>,
LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v4 1/3] mm/gup: add make_dirty arg to
put_user_pages_dirty_lock()
On 7/31/19 11:07 PM, Christoph Hellwig wrote:
> On Tue, Jul 30, 2019 at 01:57:03PM -0700, john.hubbard@...il.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
Powered by blists - more mailing lists