[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20191016174955.300d5fd4968537151d3ad43f@linux-foundation.org>
Date: Wed, 16 Oct 2019 17:49:55 -0700
From: Andrew Morton <akpm@...ux-foundation.org>
To: zhong jiang <zhongjiang@...wei.com>
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 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?
Powered by blists - more mailing lists