Re: [RESEND PATCH 1/1] mm/percpu.c: correct max_distance calculation for pcpu_embed_first_chunk()

2016-09-23 Thread zijun_hu
From: zijun_hu <zijun...@htc.com> it is error to represent the max range max_distance spanned by all the group areas as the offset of the highest group area plus unit size in pcpu_embed_first_chunk(), it should equal to the offset plus the size of the highest group area in order

Re: [RESEND PATCH 1/1] mm/percpu.c: correct max_distance calculation for pcpu_embed_first_chunk()

2016-09-23 Thread zijun_hu
From: zijun_hu it is error to represent the max range max_distance spanned by all the group areas as the offset of the highest group area plus unit size in pcpu_embed_first_chunk(), it should equal to the offset plus the size of the highest group area in order to fix this issue,let us find

Re: [PATCH 1/1] mm/percpu.c: correct max_distance calculation for pcpu_embed_first_chunk()

2016-09-23 Thread zijun_hu
On 2016/9/24 3:23, Tejun Heo wrote: > On Sat, Sep 24, 2016 at 02:20:24AM +0800, zijun_hu wrote: >> From: zijun_hu <zijun...@htc.com> >> >> correct max_distance from (base of the highest group + ai->unit_size) >> to (base of the highest group + the group size)

Re: [PATCH 1/1] mm/percpu.c: correct max_distance calculation for pcpu_embed_first_chunk()

2016-09-23 Thread zijun_hu
On 2016/9/24 3:23, Tejun Heo wrote: > On Sat, Sep 24, 2016 at 02:20:24AM +0800, zijun_hu wrote: >> From: zijun_hu >> >> correct max_distance from (base of the highest group + ai->unit_size) >> to (base of the highest group + the group size) >> >> Signed-o

[PATCH 1/1] mm/percpu.c: correct max_distance calculation for pcpu_embed_first_chunk()

2016-09-23 Thread zijun_hu
From: zijun_hu <zijun...@htc.com> correct max_distance from (base of the highest group + ai->unit_size) to (base of the highest group + the group size) Signed-off-by: zijun_hu <zijun...@htc.com> --- mm/percpu.c | 14 -- 1 file changed, 8 insertions(+), 6 deletions

[PATCH 1/1] mm/percpu.c: correct max_distance calculation for pcpu_embed_first_chunk()

2016-09-23 Thread zijun_hu
From: zijun_hu correct max_distance from (base of the highest group + ai->unit_size) to (base of the highest group + the group size) Signed-off-by: zijun_hu --- mm/percpu.c | 14 -- 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/mm/percpu.c b/mm/percpu.c in

[PATCH 1/1] mm/percpu.c: simplify grouping cpu logic in pcpu_build_alloc_info()

2016-09-23 Thread zijun_hu
From: zijun_hu <zijun...@htc.com> simplify grouping cpu logic in pcpu_build_alloc_info() to improve readability and performance, it discards the goto statement too for every possible cpu, decide whether it can share group id of any lower index CPU, use the group id if so, otherwise a new

[PATCH 1/1] mm/percpu.c: simplify grouping cpu logic in pcpu_build_alloc_info()

2016-09-23 Thread zijun_hu
From: zijun_hu simplify grouping cpu logic in pcpu_build_alloc_info() to improve readability and performance, it discards the goto statement too for every possible cpu, decide whether it can share group id of any lower index CPU, use the group id if so, otherwise a new group id is allocated

Re: [PATCH 1/1] lib/ioremap.c: avoid endless loop under ioremapping page unaligned ranges

2016-09-23 Thread zijun_hu
On 2016/9/23 22:42, Tejun Heo wrote: > Hello, > > On Wed, Sep 21, 2016 at 12:19:53PM +0800, zijun_hu wrote: >> From: zijun_hu <zijun...@htc.com> >> >> endless loop maybe happen if either of parameter addr and end is not >> page aligned for kernel API funct

Re: [PATCH 1/1] lib/ioremap.c: avoid endless loop under ioremapping page unaligned ranges

2016-09-23 Thread zijun_hu
On 2016/9/23 22:42, Tejun Heo wrote: > Hello, > > On Wed, Sep 21, 2016 at 12:19:53PM +0800, zijun_hu wrote: >> From: zijun_hu >> >> endless loop maybe happen if either of parameter addr and end is not >> page aligned for kernel API function ioremap_page_range()

Re: [PATCH 1/1] lib/ioremap.c: avoid endless loop under ioremapping page unaligned ranges

2016-09-23 Thread zijun_hu
On 2016/9/23 22:27, Michal Hocko wrote: > On Fri 23-09-16 22:14:40, zijun_hu wrote: >> On 2016/9/23 21:33, Michal Hocko wrote: >>> On Fri 23-09-16 21:00:18, zijun_hu wrote: >>>> On 09/23/2016 08:42 PM, Michal Hocko wrote: >>>>>>>> no, it

Re: [PATCH 1/1] lib/ioremap.c: avoid endless loop under ioremapping page unaligned ranges

2016-09-23 Thread zijun_hu
On 2016/9/23 22:27, Michal Hocko wrote: > On Fri 23-09-16 22:14:40, zijun_hu wrote: >> On 2016/9/23 21:33, Michal Hocko wrote: >>> On Fri 23-09-16 21:00:18, zijun_hu wrote: >>>> On 09/23/2016 08:42 PM, Michal Hocko wrote: >>>>>>>> no, it

Re: [PATCH 1/1] lib/ioremap.c: avoid endless loop under ioremapping page unaligned ranges

2016-09-23 Thread zijun_hu
On 2016/9/23 21:33, Michal Hocko wrote: > On Fri 23-09-16 21:00:18, zijun_hu wrote: >> On 09/23/2016 08:42 PM, Michal Hocko wrote: >>>>>> no, it don't work for many special case >>>>>> for example, provided PMD_SIZE=2M >>>>>> mapping

Re: [PATCH 1/1] lib/ioremap.c: avoid endless loop under ioremapping page unaligned ranges

2016-09-23 Thread zijun_hu
On 2016/9/23 21:33, Michal Hocko wrote: > On Fri 23-09-16 21:00:18, zijun_hu wrote: >> On 09/23/2016 08:42 PM, Michal Hocko wrote: >>>>>> no, it don't work for many special case >>>>>> for example, provided PMD_SIZE=2M >>>>>> mapping

Re: [PATCH 1/1] lib/ioremap.c: avoid endless loop under ioremapping page unaligned ranges

2016-09-23 Thread zijun_hu
On 09/23/2016 08:42 PM, Michal Hocko wrote: no, it don't work for many special case for example, provided PMD_SIZE=2M mapping [0x1f8800, 0x208800) virtual range will be split to two ranges [0x1f8800, 0x20) and [0x20,0x208800) and map them separately the first

Re: [PATCH 1/1] lib/ioremap.c: avoid endless loop under ioremapping page unaligned ranges

2016-09-23 Thread zijun_hu
On 09/23/2016 08:42 PM, Michal Hocko wrote: no, it don't work for many special case for example, provided PMD_SIZE=2M mapping [0x1f8800, 0x208800) virtual range will be split to two ranges [0x1f8800, 0x20) and [0x20,0x208800) and map them separately the first

Re: [PATCH 1/1] lib/ioremap.c: avoid endless loop under ioremapping page unaligned ranges

2016-09-23 Thread zijun_hu
On 2016/9/23 16:45, Michal Hocko wrote: > On Thu 22-09-16 23:13:17, zijun_hu wrote: >> On 2016/9/22 20:47, Michal Hocko wrote: >>> On Wed 21-09-16 12:19:53, zijun_hu wrote: >>>> From: zijun_hu <zijun...@htc.com> >>>> >>>> e

Re: [PATCH 1/1] lib/ioremap.c: avoid endless loop under ioremapping page unaligned ranges

2016-09-23 Thread zijun_hu
On 2016/9/23 16:45, Michal Hocko wrote: > On Thu 22-09-16 23:13:17, zijun_hu wrote: >> On 2016/9/22 20:47, Michal Hocko wrote: >>> On Wed 21-09-16 12:19:53, zijun_hu wrote: >>>> From: zijun_hu >>>> >>>> endless loop maybe happen if eit

Re: [PATCH v2 5/5] mm/vmalloc.c: avoid endless loop under v[un]mapping improper ranges

2016-09-22 Thread zijun_hu
On 09/21/2016 12:34 PM, zijun_hu wrote: > From: zijun_hu <zijun...@htc.com> > > fix the following bug: > - endless loop maybe happen when v[un]mapping improper ranges >whose either boundary is not aligned to page > > Signed-off-by: zijun_hu <zijun...@htc.

Re: [PATCH v2 5/5] mm/vmalloc.c: avoid endless loop under v[un]mapping improper ranges

2016-09-22 Thread zijun_hu
On 09/21/2016 12:34 PM, zijun_hu wrote: > From: zijun_hu > > fix the following bug: > - endless loop maybe happen when v[un]mapping improper ranges >whose either boundary is not aligned to page > > Signed-off-by: zijun_hu > --- > mm/vmalloc.c | 9 +++-- >

Re: [PATCH v2 1/1] lib/ioremap.c: avoid endless loop under ioremapping page unaligned ranges

2016-09-22 Thread zijun_hu
On 09/21/2016 12:19 PM, zijun_hu wrote: > From: zijun_hu <zijun...@htc.com> > > endless loop maybe happen if either of parameter addr and end is not > page aligned for kernel API function ioremap_page_range() > > in order to fix this issue and alert improper range para

Re: [PATCH v2 1/1] lib/ioremap.c: avoid endless loop under ioremapping page unaligned ranges

2016-09-22 Thread zijun_hu
On 09/21/2016 12:19 PM, zijun_hu wrote: > From: zijun_hu > > endless loop maybe happen if either of parameter addr and end is not > page aligned for kernel API function ioremap_page_range() > > in order to fix this issue and alert improper range parameters to user &

Re: [PATCH 3/5] mm/vmalloc.c: correct lazy_max_pages() return value

2016-09-22 Thread zijun_hu
On 2016/9/23 11:30, Nicholas Piggin wrote: > On Fri, 23 Sep 2016 00:30:20 +0800 > zijun_hu <zijun...@zoho.com> wrote: > >> On 2016/9/22 20:37, Michal Hocko wrote: >>> On Thu 22-09-16 09:13:50, zijun_hu wrote: >>>> On 09/22/2016 08:35 AM, David Rien

Re: [PATCH 3/5] mm/vmalloc.c: correct lazy_max_pages() return value

2016-09-22 Thread zijun_hu
On 2016/9/23 11:30, Nicholas Piggin wrote: > On Fri, 23 Sep 2016 00:30:20 +0800 > zijun_hu wrote: > >> On 2016/9/22 20:37, Michal Hocko wrote: >>> On Thu 22-09-16 09:13:50, zijun_hu wrote: >>>> On 09/22/2016 08:35 AM, David Rientjes wrote: >>> [..

Re: [PATCH 3/5] mm/vmalloc.c: correct lazy_max_pages() return value

2016-09-22 Thread zijun_hu
On 2016/9/22 20:37, Michal Hocko wrote: > On Thu 22-09-16 09:13:50, zijun_hu wrote: >> On 09/22/2016 08:35 AM, David Rientjes wrote: > [...] >>> The intent is as it is implemented; with your change, lazy_max_pages() is >>> potentially increased dependin

Re: [PATCH 3/5] mm/vmalloc.c: correct lazy_max_pages() return value

2016-09-22 Thread zijun_hu
On 2016/9/22 20:37, Michal Hocko wrote: > On Thu 22-09-16 09:13:50, zijun_hu wrote: >> On 09/22/2016 08:35 AM, David Rientjes wrote: > [...] >>> The intent is as it is implemented; with your change, lazy_max_pages() is >>> potentially increased dependin

Re: [PATCH 1/1] lib/ioremap.c: avoid endless loop under ioremapping page unaligned ranges

2016-09-22 Thread zijun_hu
On 2016/9/22 20:47, Michal Hocko wrote: > On Wed 21-09-16 12:19:53, zijun_hu wrote: >> From: zijun_hu <zijun...@htc.com> >> >> endless loop maybe happen if either of parameter addr and end is not >> page aligned for kernel API function ioremap_page_range()

Re: [PATCH 1/1] lib/ioremap.c: avoid endless loop under ioremapping page unaligned ranges

2016-09-22 Thread zijun_hu
On 2016/9/22 20:47, Michal Hocko wrote: > On Wed 21-09-16 12:19:53, zijun_hu wrote: >> From: zijun_hu >> >> endless loop maybe happen if either of parameter addr and end is not >> page aligned for kernel API function ioremap_page_range() > > Does this hap

Re: [RFC PATCH 1/5] mm/vmalloc.c: correct a few logic error for __insert_vmap_area()

2016-09-21 Thread zijun_hu
On 09/21/2016 12:23 PM, zijun_hu wrote: > From: zijun_hu <zijun...@htc.com> > > correct a few logic error for __insert_vmap_area() since the else > if condition is always true and meaningless > > in order to fix this issue, if vmap_area inserted is lower than one >

Re: [RFC PATCH 1/5] mm/vmalloc.c: correct a few logic error for __insert_vmap_area()

2016-09-21 Thread zijun_hu
On 09/21/2016 12:23 PM, zijun_hu wrote: > From: zijun_hu > > correct a few logic error for __insert_vmap_area() since the else > if condition is always true and meaningless > > in order to fix this issue, if vmap_area inserted is lower than one > on rbtree then wa

Re: [PATCH 3/5] mm/vmalloc.c: correct lazy_max_pages() return value

2016-09-21 Thread zijun_hu
On 09/22/2016 08:35 AM, David Rientjes wrote: > On Thu, 22 Sep 2016, zijun_hu wrote: > >> On 2016/9/22 5:21, David Rientjes wrote: >>> On Wed, 21 Sep 2016, zijun_hu wrote: >>> >>>> From: zijun_hu <zijun...@htc.com> >>>> >>>>

Re: [PATCH 3/5] mm/vmalloc.c: correct lazy_max_pages() return value

2016-09-21 Thread zijun_hu
On 09/22/2016 08:35 AM, David Rientjes wrote: > On Thu, 22 Sep 2016, zijun_hu wrote: > >> On 2016/9/22 5:21, David Rientjes wrote: >>> On Wed, 21 Sep 2016, zijun_hu wrote: >>> >>>> From: zijun_hu >>>> >>>> correct lazy_max_pa

Re: [PATCH 1/5] mm/vmalloc.c: correct a few logic error for __insert_vmap_area()

2016-09-21 Thread zijun_hu
On 2016/9/22 7:15, David Rientjes wrote: > On Thu, 22 Sep 2016, zijun_hu wrote: > >>> We don't support inserting when va->va_start == tmp_va->va_end, plain and >>> simple. There's no reason to do so. NACK to the patch. >>> >> i am sorry i disagree

Re: [PATCH 1/5] mm/vmalloc.c: correct a few logic error for __insert_vmap_area()

2016-09-21 Thread zijun_hu
On 2016/9/22 7:15, David Rientjes wrote: > On Thu, 22 Sep 2016, zijun_hu wrote: > >>> We don't support inserting when va->va_start == tmp_va->va_end, plain and >>> simple. There's no reason to do so. NACK to the patch. >>> >> i am sorry i disagree

Re: [PATCH 3/5] mm/vmalloc.c: correct lazy_max_pages() return value

2016-09-21 Thread zijun_hu
On 2016/9/22 5:21, David Rientjes wrote: > On Wed, 21 Sep 2016, zijun_hu wrote: > >> From: zijun_hu <zijun...@htc.com> >> >> correct lazy_max_pages() return value if the number of online >> CPUs is power of 2 >> >> Signed-off-by: zijun_hu <zijun

Re: [PATCH 3/5] mm/vmalloc.c: correct lazy_max_pages() return value

2016-09-21 Thread zijun_hu
On 2016/9/22 5:21, David Rientjes wrote: > On Wed, 21 Sep 2016, zijun_hu wrote: > >> From: zijun_hu >> >> correct lazy_max_pages() return value if the number of online >> CPUs is power of 2 >> >> Signed-off-by: zijun_hu >> --- >> mm/vma

Re: [PATCH 2/5] mm/vmalloc.c: simplify /proc/vmallocinfo implementation

2016-09-21 Thread zijun_hu
On 2016/9/22 5:16, David Rientjes wrote: > On Wed, 21 Sep 2016, zijun_hu wrote: > >> diff --git a/mm/vmalloc.c b/mm/vmalloc.c >> index cc6ecd6..a125ae8 100644 >> --- a/mm/vmalloc.c >> +++ b/mm/vmalloc.c >> @@ -2576,32 +2576,13 @@ void pcpu_free_vm_areas(st

Re: [PATCH 2/5] mm/vmalloc.c: simplify /proc/vmallocinfo implementation

2016-09-21 Thread zijun_hu
On 2016/9/22 5:16, David Rientjes wrote: > On Wed, 21 Sep 2016, zijun_hu wrote: > >> diff --git a/mm/vmalloc.c b/mm/vmalloc.c >> index cc6ecd6..a125ae8 100644 >> --- a/mm/vmalloc.c >> +++ b/mm/vmalloc.c >> @@ -2576,32 +2576,13 @@ void pcpu_free_vm_areas(st

Re: [PATCH 1/5] mm/vmalloc.c: correct a few logic error for __insert_vmap_area()

2016-09-21 Thread zijun_hu
On 2016/9/22 6:45, David Rientjes wrote: > On Thu, 22 Sep 2016, zijun_hu wrote: > >>>> correct a few logic error for __insert_vmap_area() since the else >>>> if condition is always true and meaningless >>>> >>>> in order to fix this issue,

Re: [PATCH 1/5] mm/vmalloc.c: correct a few logic error for __insert_vmap_area()

2016-09-21 Thread zijun_hu
On 2016/9/22 6:45, David Rientjes wrote: > On Thu, 22 Sep 2016, zijun_hu wrote: > >>>> correct a few logic error for __insert_vmap_area() since the else >>>> if condition is always true and meaningless >>>> >>>> in order to fix this issue,

Re: [PATCH 1/5] mm/vmalloc.c: correct a few logic error for __insert_vmap_area()

2016-09-21 Thread zijun_hu
On 2016/9/22 5:10, David Rientjes wrote: > On Wed, 21 Sep 2016, zijun_hu wrote: > >> From: zijun_hu <zijun...@htc.com> >> >> correct a few logic error for __insert_vmap_area() since the else >> if condition is always true and meaningless >> >> i

Re: [PATCH 1/5] mm/vmalloc.c: correct a few logic error for __insert_vmap_area()

2016-09-21 Thread zijun_hu
On 2016/9/22 5:10, David Rientjes wrote: > On Wed, 21 Sep 2016, zijun_hu wrote: > >> From: zijun_hu >> >> correct a few logic error for __insert_vmap_area() since the else >> if condition is always true and meaningless >> >> in order to fix this issu

Re: [PATCH 2/3] lib/ioremap.c: avoid endless loop under ioremapping improper ranges

2016-09-20 Thread zijun_hu
On 09/20/2016 01:49 PM, zijun_hu wrote: > From: zijun_hu <zijun...@htc.com> > > for ioremap_page_range(), endless loop maybe happen if either of parameter > addr and end is not page aligned, in order to fix this issue and hint range > parameter requirements BUG_ON() checkup

Re: [PATCH 2/3] lib/ioremap.c: avoid endless loop under ioremapping improper ranges

2016-09-20 Thread zijun_hu
On 09/20/2016 01:49 PM, zijun_hu wrote: > From: zijun_hu > > for ioremap_page_range(), endless loop maybe happen if either of parameter > addr and end is not page aligned, in order to fix this issue and hint range > parameter requirements BUG_ON() checkup are pe

Re: [PATCH 3/3] mm/vmalloc: correct a few logic error in __insert_vmap_area()

2016-09-20 Thread zijun_hu
Hi All, please ignore this patch as advised by Nicholas Piggin, i split this patch to smaller patches and resend them in another mail thread On 09/20/2016 02:02 PM, zijun_hu wrote: > From: zijun_hu <zijun...@htc.com> > > correct a few logic error in __insert_vmap_area()

Re: [PATCH 3/3] mm/vmalloc: correct a few logic error in __insert_vmap_area()

2016-09-20 Thread zijun_hu
Hi All, please ignore this patch as advised by Nicholas Piggin, i split this patch to smaller patches and resend them in another mail thread On 09/20/2016 02:02 PM, zijun_hu wrote: > From: zijun_hu > > correct a few logic error in __insert_vmap_area() since the else if > conditi

[PATCH 5/5] mm/vmalloc.c: avoid endless loop under v[un]mapping improper ranges

2016-09-20 Thread zijun_hu
From: zijun_hu <zijun...@htc.com> fix the following bug: - endless loop maybe happen when v[un]mapping improper ranges whose either boundary is not aligned to page Signed-off-by: zijun_hu <zijun...@htc.com> --- mm/vmalloc.c | 9 +++-- 1 file changed, 7 insertions(+),

[PATCH 5/5] mm/vmalloc.c: avoid endless loop under v[un]mapping improper ranges

2016-09-20 Thread zijun_hu
From: zijun_hu fix the following bug: - endless loop maybe happen when v[un]mapping improper ranges whose either boundary is not aligned to page Signed-off-by: zijun_hu --- mm/vmalloc.c | 9 +++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/mm/vmalloc.c b/mm

[PATCH 4/5] mm/vmalloc.c: improve performance for pcpu_get_vm_areas()

2016-09-20 Thread zijun_hu
From: zijun_hu <zijun...@htc.com> improve performance for pcpu_get_vm_areas() in below aspects - reduce the counter of vmap_areas overlay checkup loop to half - find the previous or next one of a vamp_area by list_head but rbtree Signed-off-by: zijun_hu <zijun...@htc.com> --- i

[PATCH 4/5] mm/vmalloc.c: improve performance for pcpu_get_vm_areas()

2016-09-20 Thread zijun_hu
From: zijun_hu improve performance for pcpu_get_vm_areas() in below aspects - reduce the counter of vmap_areas overlay checkup loop to half - find the previous or next one of a vamp_area by list_head but rbtree Signed-off-by: zijun_hu --- include/linux/list.h | 11 +++ mm/internal.h

[PATCH 3/5] mm/vmalloc.c: correct lazy_max_pages() return value

2016-09-20 Thread zijun_hu
From: zijun_hu <zijun...@htc.com> correct lazy_max_pages() return value if the number of online CPUs is power of 2 Signed-off-by: zijun_hu <zijun...@htc.com> --- mm/vmalloc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mm/vmalloc.c b/mm/vmalloc.c i

[PATCH 3/5] mm/vmalloc.c: correct lazy_max_pages() return value

2016-09-20 Thread zijun_hu
From: zijun_hu correct lazy_max_pages() return value if the number of online CPUs is power of 2 Signed-off-by: zijun_hu --- mm/vmalloc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mm/vmalloc.c b/mm/vmalloc.c index a125ae8..2804224 100644 --- a/mm/vmalloc.c +++ b/mm

[PATCH 2/5] mm/vmalloc.c: simplify /proc/vmallocinfo implementation

2016-09-20 Thread zijun_hu
From: zijun_hu <zijun...@htc.com> simplify /proc/vmallocinfo implementation via seq_file helpers for list_head Signed-off-by: zijun_hu <zijun...@htc.com> --- mm/vmalloc.c | 27 +-- 1 file changed, 5 insertions(+), 22 deletions(-) diff --git a/mm/vmalloc.c b/

[PATCH 2/5] mm/vmalloc.c: simplify /proc/vmallocinfo implementation

2016-09-20 Thread zijun_hu
From: zijun_hu simplify /proc/vmallocinfo implementation via seq_file helpers for list_head Signed-off-by: zijun_hu --- mm/vmalloc.c | 27 +-- 1 file changed, 5 insertions(+), 22 deletions(-) diff --git a/mm/vmalloc.c b/mm/vmalloc.c index cc6ecd6..a125ae8 100644

[PATCH 1/5] mm/vmalloc.c: correct a few logic error for __insert_vmap_area()

2016-09-20 Thread zijun_hu
From: zijun_hu <zijun...@htc.com> correct a few logic error for __insert_vmap_area() since the else if condition is always true and meaningless in order to fix this issue, if vmap_area inserted is lower than one on rbtree then walk around left branch; if higher then right branch oth

[PATCH 1/5] mm/vmalloc.c: correct a few logic error for __insert_vmap_area()

2016-09-20 Thread zijun_hu
From: zijun_hu correct a few logic error for __insert_vmap_area() since the else if condition is always true and meaningless in order to fix this issue, if vmap_area inserted is lower than one on rbtree then walk around left branch; if higher then right branch otherwise intersects

[PATCH 1/1] lib/ioremap.c: avoid endless loop under ioremapping page unaligned ranges

2016-09-20 Thread zijun_hu
From: zijun_hu <zijun...@htc.com> endless loop maybe happen if either of parameter addr and end is not page aligned for kernel API function ioremap_page_range() in order to fix this issue and alert improper range parameters to user WARN_ON() checkup and rounding down range lower bo

[PATCH 1/1] lib/ioremap.c: avoid endless loop under ioremapping page unaligned ranges

2016-09-20 Thread zijun_hu
From: zijun_hu endless loop maybe happen if either of parameter addr and end is not page aligned for kernel API function ioremap_page_range() in order to fix this issue and alert improper range parameters to user WARN_ON() checkup and rounding down range lower boundary are performed firstly

[RESEND PATCH 1/1] linux/mm.h: canonicalize macro PAGE_ALIGNED() definition

2016-09-20 Thread zijun_hu
From: zijun_hu <zijun...@htc.com> canonicalize macro PAGE_ALIGNED() definition Signed-off-by: zijun_hu <zijun...@htc.com> --- include/linux/mm.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/mm.h b/include/linux/mm.h index ef815b9..ec

[RESEND PATCH 1/1] linux/mm.h: canonicalize macro PAGE_ALIGNED() definition

2016-09-20 Thread zijun_hu
From: zijun_hu canonicalize macro PAGE_ALIGNED() definition Signed-off-by: zijun_hu --- include/linux/mm.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/mm.h b/include/linux/mm.h index ef815b9..ec68186 100644 --- a/include/linux/mm.h +++ b/include/linux

Re: [PATCH 3/3] mm/vmalloc: correct a few logic error in __insert_vmap_area()

2016-09-20 Thread zijun_hu
On 09/20/2016 02:54 PM, Nicholas Piggin wrote: > On Tue, 20 Sep 2016 14:02:26 +0800 > zijun_hu <zijun...@zoho.com> wrote: > >> From: zijun_hu <zijun...@htc.com> >> >> correct a few logic error in __insert_vmap_area() since the else if >> conditi

Re: [PATCH 3/3] mm/vmalloc: correct a few logic error in __insert_vmap_area()

2016-09-20 Thread zijun_hu
On 09/20/2016 02:54 PM, Nicholas Piggin wrote: > On Tue, 20 Sep 2016 14:02:26 +0800 > zijun_hu wrote: > >> From: zijun_hu >> >> correct a few logic error in __insert_vmap_area() since the else if >> condition is always true and meaningless >> >>

[PATCH 3/3] mm/vmalloc: correct a few logic error in __insert_vmap_area()

2016-09-20 Thread zijun_hu
From: zijun_hu <zijun...@htc.com> correct a few logic error in __insert_vmap_area() since the else if condition is always true and meaningless avoid endless loop under [un]mapping improper ranges whose boundary are not aligned to page correct lazy_max_pages() return value if the

[PATCH 3/3] mm/vmalloc: correct a few logic error in __insert_vmap_area()

2016-09-20 Thread zijun_hu
From: zijun_hu correct a few logic error in __insert_vmap_area() since the else if condition is always true and meaningless avoid endless loop under [un]mapping improper ranges whose boundary are not aligned to page correct lazy_max_pages() return value if the number of online cpus is power

[PATCH 2/3] lib/ioremap.c: avoid endless loop under ioremapping improper ranges

2016-09-19 Thread zijun_hu
From: zijun_hu <zijun...@htc.com> for ioremap_page_range(), endless loop maybe happen if either of parameter addr and end is not page aligned, in order to fix this issue and hint range parameter requirements BUG_ON() checkup are performed firstly for ioremap_pte_range(), loop end con

[PATCH 2/3] lib/ioremap.c: avoid endless loop under ioremapping improper ranges

2016-09-19 Thread zijun_hu
From: zijun_hu for ioremap_page_range(), endless loop maybe happen if either of parameter addr and end is not page aligned, in order to fix this issue and hint range parameter requirements BUG_ON() checkup are performed firstly for ioremap_pte_range(), loop end condition is optimized due

[PATCH 1/3] linux/mm.h: canonicalize macro PAGE_ALIGNED() definition

2016-09-19 Thread zijun_hu
From: zijun_hu <zijun...@htc.com> canonicalize macro PAGE_ALIGNED() definition Signed-off-by: zijun_hu <zijun...@htc.com> --- include/linux/mm.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/mm.h b/include/linux/mm.h index ef815b9..ec

[PATCH 1/3] linux/mm.h: canonicalize macro PAGE_ALIGNED() definition

2016-09-19 Thread zijun_hu
From: zijun_hu canonicalize macro PAGE_ALIGNED() definition Signed-off-by: zijun_hu --- include/linux/mm.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/mm.h b/include/linux/mm.h index ef815b9..ec68186 100644 --- a/include/linux/mm.h +++ b/include/linux

Re: mm: GPF in __insert_vmap_area

2016-09-04 Thread zijun_hu
On 09/03/2016 08:15 PM, Dmitry Vyukov wrote: > Hello, > > While running syzkaller fuzzer I've got the following GPF: > > general protection fault: [#1] SMP DEBUG_PAGEALLOC KASAN > Dumping ftrace buffer: >(ftrace buffer empty) > Modules linked in: > CPU: 2 PID: 4268 Comm: syz-executor

Re: mm: GPF in __insert_vmap_area

2016-09-04 Thread zijun_hu
On 09/03/2016 08:15 PM, Dmitry Vyukov wrote: > Hello, > > While running syzkaller fuzzer I've got the following GPF: > > general protection fault: [#1] SMP DEBUG_PAGEALLOC KASAN > Dumping ftrace buffer: >(ftrace buffer empty) > Modules linked in: > CPU: 2 PID: 4268 Comm: syz-executor

Re: [PATCH 2/2] arm64: regard FDT_SW_MAGIC as good fdt magic

2016-09-01 Thread zijun_hu
On 09/01/2016 07:21 PM, Mark Rutland wrote: > On Thu, Sep 01, 2016 at 06:58:29PM +0800, zijun_hu wrote: >> From: zijun_hu <zijun...@htc.com> >> >> regard FDT_SW_MAGIC as good fdt magic during mapping fdt area >> see fdt_check_header() for details > > It loo

Re: [PATCH 2/2] arm64: regard FDT_SW_MAGIC as good fdt magic

2016-09-01 Thread zijun_hu
On 09/01/2016 07:21 PM, Mark Rutland wrote: > On Thu, Sep 01, 2016 at 06:58:29PM +0800, zijun_hu wrote: >> From: zijun_hu >> >> regard FDT_SW_MAGIC as good fdt magic during mapping fdt area >> see fdt_check_header() for details > > It looks like we shoul

[PATCH 2/2] arm64: regard FDT_SW_MAGIC as good fdt magic

2016-09-01 Thread zijun_hu
From: zijun_hu <zijun...@htc.com> regard FDT_SW_MAGIC as good fdt magic during mapping fdt area see fdt_check_header() for details Signed-off-by: zijun_hu <zijun...@htc.com> --- arch/arm64/mm/mmu.c | 3 ++- scripts/dtc/libfdt/fdt.h | 3 ++- script

[PATCH 2/2] arm64: regard FDT_SW_MAGIC as good fdt magic

2016-09-01 Thread zijun_hu
From: zijun_hu regard FDT_SW_MAGIC as good fdt magic during mapping fdt area see fdt_check_header() for details Signed-off-by: zijun_hu --- arch/arm64/mm/mmu.c | 3 ++- scripts/dtc/libfdt/fdt.h | 3 ++- scripts/dtc/libfdt/libfdt.h | 2 ++ scripts/dtc

[PATCH 1/2] arm64: remove duplicate macro __KERNEL__ check

2016-09-01 Thread zijun_hu
From: zijun_hu <zijun...@htc.com> remove duplicate macro __KERNEL__ check Signed-off-by: zijun_hu <zijun...@htc.com> --- arch/arm64/include/asm/processor.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/arch/arm64/include/asm/processor.h b/arch/arm64/include/asm/proce

[PATCH 1/2] arm64: remove duplicate macro __KERNEL__ check

2016-09-01 Thread zijun_hu
From: zijun_hu remove duplicate macro __KERNEL__ check Signed-off-by: zijun_hu --- arch/arm64/include/asm/processor.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/arch/arm64/include/asm/processor.h b/arch/arm64/include/asm/processor.h index ace0a96e7d6e..df2e53d3a969 100644

Re: [PATCH 1/2] mm/nobootmem.c: make CONFIG_NO_BOOTMEM depend on CONFIG_HAVE_MEMBLOCK

2016-08-29 Thread zijun_hu
i am sorry, this patch has many bugs i resend it in another mail thread please ignore it On 2016/8/27 23:27, zijun_hu wrote: > From: zijun_hu <zijun...@htc.com> > > this patch fixes the following bugs: > > - no bootmem is implemented by memblock current

Re: [PATCH 1/2] mm/nobootmem.c: make CONFIG_NO_BOOTMEM depend on CONFIG_HAVE_MEMBLOCK

2016-08-29 Thread zijun_hu
i am sorry, this patch has many bugs i resend it in another mail thread please ignore it On 2016/8/27 23:27, zijun_hu wrote: > From: zijun_hu > > this patch fixes the following bugs: > > - no bootmem is implemented by memblock currently, but config option >CONFIG_NO_BOOT

Re: [PATCH 2/2] mm/bootmem.c: substitute kzalloc_node() for kzalloc()

2016-08-29 Thread zijun_hu
i am sorry, this patch has many bugs i resend it in another mail thread please ignore it On 2016/8/27 23:35, zijun_hu wrote: > From: zijun_hu <zijun...@htc.com> > > in ___alloc_bootmem_node_nopanic(), substitute kzalloc_node() > for kzalloc() in order to allocate memory

Re: [PATCH 2/2] mm/bootmem.c: substitute kzalloc_node() for kzalloc()

2016-08-29 Thread zijun_hu
i am sorry, this patch has many bugs i resend it in another mail thread please ignore it On 2016/8/27 23:35, zijun_hu wrote: > From: zijun_hu > > in ___alloc_bootmem_node_nopanic(), substitute kzalloc_node() > for kzalloc() in order to allocate memory within given node > pref

Re: [PATCH 1/2] mm/nobootmem.c: make CONFIG_NO_BOOTMEM depend on CONFIG_HAVE_MEMBLOCK

2016-08-29 Thread zijun_hu
i am sorry, this patch has many bugs i resend it in another mail thread please ignore it On 2016/8/28 15:48, kbuild test robot wrote: > Hi zijun_hu, > > [auto build test ERROR on mmotm/master] > [also build test ERROR on v4.8-rc3 next-20160825] > [if your patch is applied to the

Re: [PATCH 1/2] mm/nobootmem.c: make CONFIG_NO_BOOTMEM depend on CONFIG_HAVE_MEMBLOCK

2016-08-29 Thread zijun_hu
i am sorry, this patch has many bugs i resend it in another mail thread please ignore it On 2016/8/28 15:48, kbuild test robot wrote: > Hi zijun_hu, > > [auto build test ERROR on mmotm/master] > [also build test ERROR on v4.8-rc3 next-20160825] > [if your patch is applied to the

[PATCH 2/2] mm/bootmem.c: replace kzalloc() by kzalloc_node()

2016-08-29 Thread zijun_hu
From: zijun_hu <zijun...@htc.com> in ___alloc_bootmem_node_nopanic(), replace kzalloc() by kzalloc_node() in order to allocate memory within given node preferentially when slab is available Signed-off-by: zijun_hu <zijun...@htc.com> --- mm/bootmem.c | 14 ++ 1 fil

[PATCH 2/2] mm/bootmem.c: replace kzalloc() by kzalloc_node()

2016-08-29 Thread zijun_hu
From: zijun_hu in ___alloc_bootmem_node_nopanic(), replace kzalloc() by kzalloc_node() in order to allocate memory within given node preferentially when slab is available Signed-off-by: zijun_hu --- mm/bootmem.c | 14 ++ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git

[PATCH 1/2] mm/nobootmem.c: remove duplicate macro ARCH_LOW_ADDRESS_LIMIT statements

2016-08-29 Thread zijun_hu
From: zijun_hu <zijun...@htc.com> this patch fixes the following bugs: - the same ARCH_LOW_ADDRESS_LIMIT statements are duplicated between header and relevant source - don't ensure ARCH_LOW_ADDRESS_LIMIT perhaps defined by ARCH in asm/processor.h is preferred over default in

[PATCH 1/2] mm/nobootmem.c: remove duplicate macro ARCH_LOW_ADDRESS_LIMIT statements

2016-08-29 Thread zijun_hu
From: zijun_hu this patch fixes the following bugs: - the same ARCH_LOW_ADDRESS_LIMIT statements are duplicated between header and relevant source - don't ensure ARCH_LOW_ADDRESS_LIMIT perhaps defined by ARCH in asm/processor.h is preferred over default in linux/bootmem.h completely

[PATCH 2/2] mm/bootmem.c: substitute kzalloc_node() for kzalloc()

2016-08-27 Thread zijun_hu
From: zijun_hu <zijun...@htc.com> in ___alloc_bootmem_node_nopanic(), substitute kzalloc_node() for kzalloc() in order to allocate memory within given node preferentially when slab is available free_all_bootmem_core() is optimized to make the first two parameters of __free_pages_bootmem()

[PATCH 2/2] mm/bootmem.c: substitute kzalloc_node() for kzalloc()

2016-08-27 Thread zijun_hu
From: zijun_hu in ___alloc_bootmem_node_nopanic(), substitute kzalloc_node() for kzalloc() in order to allocate memory within given node preferentially when slab is available free_all_bootmem_core() is optimized to make the first two parameters of __free_pages_bootmem() looks consistent

[PATCH 1/2] mm/nobootmem.c: make CONFIG_NO_BOOTMEM depend on CONFIG_HAVE_MEMBLOCK

2016-08-27 Thread zijun_hu
From: zijun_hu <zijun...@htc.com> this patch fixes the following bugs: - no bootmem is implemented by memblock currently, but config option CONFIG_NO_BOOTMEM doesn't depend on CONFIG_HAVE_MEMBLOCK - the same ARCH_LOW_ADDRESS_LIMIT statements are duplicated between header and re

[PATCH 1/2] mm/nobootmem.c: make CONFIG_NO_BOOTMEM depend on CONFIG_HAVE_MEMBLOCK

2016-08-27 Thread zijun_hu
From: zijun_hu this patch fixes the following bugs: - no bootmem is implemented by memblock currently, but config option CONFIG_NO_BOOTMEM doesn't depend on CONFIG_HAVE_MEMBLOCK - the same ARCH_LOW_ADDRESS_LIMIT statements are duplicated between header and relevant source - don't

[RESEND PATCH 1/1] mm/vmalloc: fix align value calculation error

2016-08-19 Thread zijun_hu
From: zijun_hu <zijun...@htc.com> it causes double align requirement for __get_vm_area_node() if parameter size is power of 2 and VM_IOREMAP is set in parameter flags, for example size=0x1 -> fls_long(0x1)=17 -> align=0x2 get_count_order_long() is implemented and

[RESEND PATCH 1/1] mm/vmalloc: fix align value calculation error

2016-08-19 Thread zijun_hu
From: zijun_hu it causes double align requirement for __get_vm_area_node() if parameter size is power of 2 and VM_IOREMAP is set in parameter flags, for example size=0x1 -> fls_long(0x1)=17 -> align=0x2 get_count_order_long() is implemented and used instead of fls_long() for

Re: [PATCH 1/1] rbtree: correct mask for extracting node's parent

2016-08-18 Thread zijun_hu
On 08/18/2016 05:01 PM, Peter Zijlstra wrote: > On Thu, Aug 18, 2016 at 04:19:10PM +0800, zijun_hu wrote: >> From: zijun_hu <zijun...@htc.com> >> >> for LP64 ABI, struct rb_node aligns at 8 bytes boundary due to >> sizeof(long) == 8 normally, so 0x07 should be

Re: [PATCH 1/1] rbtree: correct mask for extracting node's parent

2016-08-18 Thread zijun_hu
On 08/18/2016 05:01 PM, Peter Zijlstra wrote: > On Thu, Aug 18, 2016 at 04:19:10PM +0800, zijun_hu wrote: >> From: zijun_hu >> >> for LP64 ABI, struct rb_node aligns at 8 bytes boundary due to >> sizeof(long) == 8 normally, so 0x07 should be used to extract >&g

[PATCH 1/1] rbtree: correct mask for extracting node's parent

2016-08-18 Thread zijun_hu
From: zijun_hu <zijun...@htc.com> for LP64 ABI, struct rb_node aligns at 8 bytes boundary due to sizeof(long) == 8 normally, so 0x07 should be used to extract node's parent rather than 0x03 the mask is corrected based on normal alignment of struct rb_node macros are introduced to replac

[PATCH 1/1] rbtree: correct mask for extracting node's parent

2016-08-18 Thread zijun_hu
From: zijun_hu for LP64 ABI, struct rb_node aligns at 8 bytes boundary due to sizeof(long) == 8 normally, so 0x07 should be used to extract node's parent rather than 0x03 the mask is corrected based on normal alignment of struct rb_node macros are introduced to replace hard coding numbers too

Re: [RESEND PATCH 1/1] bitops.h: move out get_count_order[_long]() from __KERNEL__ scope

2016-08-17 Thread zijun_hu
On 2016/8/18 8:28, Al Viro wrote: > On Thu, Aug 18, 2016 at 08:10:19AM +0800, zijun_hu wrote: > >> Documentation/kbuild/makefiles.txt: >> The kernel includes a set of headers that is exported to userspace. >> Many headers can be exported as-is but other headers require a &

Re: [RESEND PATCH 1/1] bitops.h: move out get_count_order[_long]() from __KERNEL__ scope

2016-08-17 Thread zijun_hu
On 2016/8/18 8:28, Al Viro wrote: > On Thu, Aug 18, 2016 at 08:10:19AM +0800, zijun_hu wrote: > >> Documentation/kbuild/makefiles.txt: >> The kernel includes a set of headers that is exported to userspace. >> Many headers can be exported as-is but other headers require a &

Re: [RESEND PATCH 1/1] bitops.h: move out get_count_order[_long]() from __KERNEL__ scope

2016-08-17 Thread zijun_hu
On 2016/8/18 7:59, Al Viro wrote: > On Thu, Aug 18, 2016 at 07:51:19AM +0800, zijun_hu wrote: >>> What the hell is anything without __KERNEL__ doing with linux/bitops.h in >>> the first place? IOW, why do we have those ifdefs at all? >>> >> >> __KERNEL__

Re: [RESEND PATCH 1/1] bitops.h: move out get_count_order[_long]() from __KERNEL__ scope

2016-08-17 Thread zijun_hu
On 2016/8/18 7:59, Al Viro wrote: > On Thu, Aug 18, 2016 at 07:51:19AM +0800, zijun_hu wrote: >>> What the hell is anything without __KERNEL__ doing with linux/bitops.h in >>> the first place? IOW, why do we have those ifdefs at all? >>> >> >> __KERNEL__

<    1   2   3   >