[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <b554db44-7315-b99f-1151-ba2a1b2445ce@nvidia.com>
Date: Mon, 3 Feb 2020 13:17:40 -0800
From: John Hubbard <jhubbard@...dia.com>
To: "Kirill A. Shutemov" <kirill@...temov.name>
CC: Andrew Morton <akpm@...ux-foundation.org>,
Al Viro <viro@...iv.linux.org.uk>,
Christoph Hellwig <hch@...radead.org>,
Dan Williams <dan.j.williams@...el.com>,
Dave Chinner <david@...morbit.com>,
Ira Weiny <ira.weiny@...el.com>, Jan Kara <jack@...e.cz>,
Jason Gunthorpe <jgg@...pe.ca>,
Jonathan Corbet <corbet@....net>,
Jérôme Glisse <jglisse@...hat.com>,
Michal Hocko <mhocko@...e.com>,
Mike Kravetz <mike.kravetz@...cle.com>,
Shuah Khan <shuah@...nel.org>,
Vlastimil Babka <vbabka@...e.cz>,
Matthew Wilcox <willy@...radead.org>,
<linux-doc@...r.kernel.org>, <linux-fsdevel@...r.kernel.org>,
<linux-kselftest@...r.kernel.org>, <linux-rdma@...r.kernel.org>,
<linux-mm@...ck.org>, LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v3 11/12] mm/gup_benchmark: support pin_user_pages() and
related calls
On 2/3/20 5:58 AM, Kirill A. Shutemov wrote:
...
>> @@ -19,6 +21,48 @@ struct gup_benchmark {
>> __u64 expansion[10]; /* For future use */
>> };
>>
>> +static void put_back_pages(unsigned int cmd, struct page **pages,
>> + unsigned long nr_pages)
>> +{
>> + int i;
>> +
>> + switch (cmd) {
>> + case GUP_FAST_BENCHMARK:
>> + case GUP_LONGTERM_BENCHMARK:
>> + case GUP_BENCHMARK:
>> + for (i = 0; i < nr_pages; i++)
>
> 'i' is 'int' and 'nr_pages' is 'unsigned long'.
> There's space for trouble :P
>
Yes, I've changed it to "unsigned int", thanks.
>> + put_page(pages[i]);
>> + break;
>> +
>> + case PIN_FAST_BENCHMARK:
>> + case PIN_BENCHMARK:
>> + unpin_user_pages(pages, nr_pages);
>> + break;
>> + }
>> +}
>> +
>> +static void verify_dma_pinned(unsigned int cmd, struct page **pages,
>> + unsigned long nr_pages)
>> +{
>> + int i;
>> + struct page *page;
>> +
>> + switch (cmd) {
>> + case PIN_FAST_BENCHMARK:
>> + case PIN_BENCHMARK:
>> + for (i = 0; i < nr_pages; i++) {
>
> Ditto.
>
Fixed here also.
>> + page = pages[i];
>> + if (WARN(!page_maybe_dma_pinned(page),
>> + "pages[%d] is NOT dma-pinned\n", i)) {
...and changed to "pages[%u]", to match.
thanks,
--
John Hubbard
NVIDIA
>> +
>> + dump_page(page, "gup_benchmark failure");
>> + break;
>> + }
>> + }
>> + break;
>> + }
>> +}
>> +
>> static int __gup_benchmark_ioctl(unsigned int cmd,
>> struct gup_benchmark *gup)
>> {
>
Powered by blists - more mailing lists