[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <5DA7C612.1090300@huawei.com>
Date: Thu, 17 Oct 2019 09:38:26 +0800
From: zhong jiang <zhongjiang@...wei.com>
To: Andrew Morton <akpm@...ux-foundation.org>
CC: John Hubbard <jhubbard@...dia.com>,
Vlastimil Babka <vbabka@...e.cz>, <mhocko@...nel.org>,
<anshuman.khandual@....com>, <linux-mm@...ck.org>,
<linux-kernel@...r.kernel.org>, Ira Weiny <ira.weiny@...el.com>,
"Aneesh Kumar K.V" <aneesh.kumar@...ux.vnet.ibm.com>
Subject: Re: [PATCH] mm: Unsigned 'nr_pages' always larger than zero
On 2019/10/17 8:49, Andrew Morton wrote:
> On Wed, 16 Oct 2019 17:07:44 +0800 zhong jiang <zhongjiang@...wei.com> wrote:
>
>>>> --- a/mm/gup.c~a
>>>> +++ a/mm/gup.c
>>>> @@ -1450,6 +1450,7 @@ static long check_and_migrate_cma_pages(
>>>> bool drain_allow = true;
>>>> bool migrate_allow = true;
>>>> LIST_HEAD(cma_page_list);
>>>> + long ret;
>>>> check_again:
>>>> for (i = 0; i < nr_pages;) {
>>>> @@ -1511,17 +1512,18 @@ check_again:
>>>> * again migrating any new CMA pages which we failed to isolate
>>>> * earlier.
>>>> */
>>>> - nr_pages = __get_user_pages_locked(tsk, mm, start, nr_pages,
>>>> + ret = __get_user_pages_locked(tsk, mm, start, nr_pages,
>>>> pages, vmas, NULL,
>>>> gup_flags);
>>>> - if ((nr_pages > 0) && migrate_allow) {
>>>> + nr_pages = ret;
>>>> + if (ret > 0 && migrate_allow) {
>>>> drain_allow = true;
>>>> goto check_again;
>>>> }
>>>> }
>>>> - return nr_pages;
>>>> + return ret;
>>>> }
>>>> #else
>>>> static long check_and_migrate_cma_pages(struct task_struct *tsk,
>>>>
>>> +1 for this approach, please.
>>>
>>>
>>> thanks,
>> Hi, Andrew
>>
>> I didn't see the fix for the issue in the upstream. Your proposal should be
>> appiled to upstream. Could you appiled the patch or repost by me ?
> Forgotten about it ;) Please send a patch sometime?
>
> .
>
I will repost the patch as your suggestion. Thanks,
Sincerely,
zhong jiang
Powered by blists - more mailing lists