Re: [PATCH] mm: Unsigned 'nr_pages' always larger than zero

2019-10-16 Thread zhong jiang
On 2019/10/17 8:49, Andrew Morton wrote: > On Wed, 16 Oct 2019 17:07:44 +0800 zhong jiang 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;

Re: [PATCH] mm: Unsigned 'nr_pages' always larger than zero

2019-10-16 Thread Andrew Morton
On Wed, 16 Oct 2019 17:07:44 +0800 zhong jiang 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; >

Re: [PATCH] mm: Unsigned 'nr_pages' always larger than zero

2019-09-05 Thread Vlastimil Babka
On 9/5/19 8:18 AM, zhong jiang wrote: > On 2019/9/5 2:48, Andrew Morton wrote: > Firstly, I consider the some modified method as you has writen down above. > It seems to work well. > According to Vlastimil's feedback, I repost the patch in v2, changing the > parameter to long to fix > the

Re: [PATCH] mm: Unsigned 'nr_pages' always larger than zero

2019-09-05 Thread zhong jiang
On 2019/9/5 2:48, Andrew Morton wrote: > On Wed, 4 Sep 2019 13:24:58 +0200 Vlastimil Babka wrote: > >> On 9/4/19 12:26 PM, zhong jiang wrote: >>> With the help of unsigned_lesser_than_zero.cocci. Unsigned 'nr_pages"' >>> compare with zero. And __get_user_pages_locked will return an long value.

Re: [PATCH] mm: Unsigned 'nr_pages' always larger than zero

2019-09-04 Thread zhong jiang
On 2019/9/4 19:24, Vlastimil Babka wrote: > On 9/4/19 12:26 PM, zhong jiang wrote: >> With the help of unsigned_lesser_than_zero.cocci. Unsigned 'nr_pages"' >> compare with zero. And __get_user_pages_locked will return an long value. >> Hence, Convert the long to compare with zero is feasible. >

Re: [PATCH] mm: Unsigned 'nr_pages' always larger than zero

2019-09-04 Thread Vlastimil Babka
On 9/4/19 9:01 PM, Andrew Morton wrote: > On Wed, 4 Sep 2019 13:24:58 +0200 Vlastimil Babka wrote: > >> On 9/4/19 12:26 PM, zhong jiang wrote: >>> With the help of unsigned_lesser_than_zero.cocci. Unsigned 'nr_pages"' >>> compare with zero. And __get_user_pages_locked will return an long value.

Re: [PATCH] mm: Unsigned 'nr_pages' always larger than zero

2019-09-04 Thread Vlastimil Babka
On 9/4/19 8:48 PM, Andrew Morton wrote: > On Wed, 4 Sep 2019 13:24:58 +0200 Vlastimil Babka wrote: > >> On 9/4/19 12:26 PM, zhong jiang wrote: >>> With the help of unsigned_lesser_than_zero.cocci. Unsigned 'nr_pages"' >>> compare with zero. And __get_user_pages_locked will return an long value.

Re: [PATCH] mm: Unsigned 'nr_pages' always larger than zero

2019-09-04 Thread Andrew Morton
On Wed, 4 Sep 2019 13:24:58 +0200 Vlastimil Babka wrote: > On 9/4/19 12:26 PM, zhong jiang wrote: > > With the help of unsigned_lesser_than_zero.cocci. Unsigned 'nr_pages"' > > compare with zero. And __get_user_pages_locked will return an long value. > > Hence, Convert the long to compare with

Re: [PATCH] mm: Unsigned 'nr_pages' always larger than zero

2019-09-04 Thread Andrew Morton
On Wed, 4 Sep 2019 13:24:58 +0200 Vlastimil Babka wrote: > On 9/4/19 12:26 PM, zhong jiang wrote: > > With the help of unsigned_lesser_than_zero.cocci. Unsigned 'nr_pages"' > > compare with zero. And __get_user_pages_locked will return an long value. > > Hence, Convert the long to compare with

Re: [PATCH] mm: Unsigned 'nr_pages' always larger than zero

2019-09-04 Thread Matthew Wilcox
On Wed, Sep 04, 2019 at 06:25:19PM +, Weiny, Ira wrote: > > On 9/4/19 12:26 PM, zhong jiang wrote: > > > With the help of unsigned_lesser_than_zero.cocci. Unsigned 'nr_pages"' > > > compare with zero. And __get_user_pages_locked will return an long > > value. > > > Hence, Convert the long to

Re: [PATCH] mm: Unsigned 'nr_pages' always larger than zero

2019-09-04 Thread Vlastimil Babka
On 9/4/19 12:26 PM, zhong jiang wrote: > With the help of unsigned_lesser_than_zero.cocci. Unsigned 'nr_pages"' > compare with zero. And __get_user_pages_locked will return an long value. > Hence, Convert the long to compare with zero is feasible. It would be nicer if the parameter nr_pages was

[PATCH] mm: Unsigned 'nr_pages' always larger than zero

2019-09-04 Thread zhong jiang
With the help of unsigned_lesser_than_zero.cocci. Unsigned 'nr_pages"' compare with zero. And __get_user_pages_locked will return an long value. Hence, Convert the long to compare with zero is feasible. Signed-off-by: zhong jiang --- mm/gup.c | 2 +- 1 file changed, 1 insertion(+), 1