Re: [RFC PATCH 1/1] mm/percpu.c: fix memory leakage issue when allocate a odd alignment area

2016-10-13 Thread zijun_hu
On 2016/10/14 8:28, Tejun Heo wrote: > Hello, > > On Fri, Oct 14, 2016 at 08:23:06AM +0800, zijun_hu wrote: >> for the current code, only power of 2 alignment value can works well >> >> is it acceptable to performing a power of 2 checking and returning error code >> if fail? > > Yeah, just add

Re: [RFC PATCH 1/1] mm/percpu.c: fix memory leakage issue when allocate a odd alignment area

2016-10-13 Thread zijun_hu
On 2016/10/14 8:28, Tejun Heo wrote: > Hello, > > On Fri, Oct 14, 2016 at 08:23:06AM +0800, zijun_hu wrote: >> for the current code, only power of 2 alignment value can works well >> >> is it acceptable to performing a power of 2 checking and returning error code >> if fail? > > Yeah, just add

Re: [RFC PATCH 1/1] mm/percpu.c: fix memory leakage issue when allocate a odd alignment area

2016-10-13 Thread Tejun Heo
Hello, On Fri, Oct 14, 2016 at 08:23:06AM +0800, zijun_hu wrote: > for the current code, only power of 2 alignment value can works well > > is it acceptable to performing a power of 2 checking and returning error code > if fail? Yeah, just add is_power_of_2() test to the existing sanity check.

Re: [RFC PATCH 1/1] mm/percpu.c: fix memory leakage issue when allocate a odd alignment area

2016-10-13 Thread Tejun Heo
Hello, On Fri, Oct 14, 2016 at 08:23:06AM +0800, zijun_hu wrote: > for the current code, only power of 2 alignment value can works well > > is it acceptable to performing a power of 2 checking and returning error code > if fail? Yeah, just add is_power_of_2() test to the existing sanity check.

Re: [RFC PATCH 1/1] mm/percpu.c: fix memory leakage issue when allocate a odd alignment area

2016-10-13 Thread zijun_hu
On 2016/10/14 7:31, Tejun Heo wrote: > On Tue, Oct 11, 2016 at 09:24:50PM +0800, zijun_hu wrote: >> From: zijun_hu >> >> the LSB of a chunk->map element is used for free/in-use flag of a area >> and the other bits for offset, the sufficient and necessary condition of >> this

Re: [RFC PATCH 1/1] mm/percpu.c: fix memory leakage issue when allocate a odd alignment area

2016-10-13 Thread zijun_hu
On 2016/10/14 7:31, Tejun Heo wrote: > On Tue, Oct 11, 2016 at 09:24:50PM +0800, zijun_hu wrote: >> From: zijun_hu >> >> the LSB of a chunk->map element is used for free/in-use flag of a area >> and the other bits for offset, the sufficient and necessary condition of >> this usage is that both

Re: [RFC PATCH 1/1] mm/percpu.c: fix memory leakage issue when allocate a odd alignment area

2016-10-13 Thread Tejun Heo
On Tue, Oct 11, 2016 at 09:24:50PM +0800, zijun_hu wrote: > From: zijun_hu > > the LSB of a chunk->map element is used for free/in-use flag of a area > and the other bits for offset, the sufficient and necessary condition of > this usage is that both size and alignment of a

Re: [RFC PATCH 1/1] mm/percpu.c: fix memory leakage issue when allocate a odd alignment area

2016-10-13 Thread Tejun Heo
On Tue, Oct 11, 2016 at 09:24:50PM +0800, zijun_hu wrote: > From: zijun_hu > > the LSB of a chunk->map element is used for free/in-use flag of a area > and the other bits for offset, the sufficient and necessary condition of > this usage is that both size and alignment of a area must be even

Re: [RFC PATCH 1/1] mm/percpu.c: fix memory leakage issue when allocate a odd alignment area

2016-10-12 Thread zijun_hu
On 10/12/2016 05:54 PM, Michal Hocko wrote: > On Wed 12-10-16 16:44:31, zijun_hu wrote: >> On 10/12/2016 04:25 PM, Michal Hocko wrote: >>> On Wed 12-10-16 15:24:33, zijun_hu wrote: > [...] i found the following code segments in mm/vmalloc.c static struct vmap_area

Re: [RFC PATCH 1/1] mm/percpu.c: fix memory leakage issue when allocate a odd alignment area

2016-10-12 Thread zijun_hu
On 10/12/2016 05:54 PM, Michal Hocko wrote: > On Wed 12-10-16 16:44:31, zijun_hu wrote: >> On 10/12/2016 04:25 PM, Michal Hocko wrote: >>> On Wed 12-10-16 15:24:33, zijun_hu wrote: > [...] i found the following code segments in mm/vmalloc.c static struct vmap_area

Re: [RFC PATCH 1/1] mm/percpu.c: fix memory leakage issue when allocate a odd alignment area

2016-10-12 Thread Michal Hocko
On Wed 12-10-16 16:44:31, zijun_hu wrote: > On 10/12/2016 04:25 PM, Michal Hocko wrote: > > On Wed 12-10-16 15:24:33, zijun_hu wrote: [...] > >> i found the following code segments in mm/vmalloc.c > >> static struct vmap_area *alloc_vmap_area(unsigned long size, > >>

Re: [RFC PATCH 1/1] mm/percpu.c: fix memory leakage issue when allocate a odd alignment area

2016-10-12 Thread Michal Hocko
On Wed 12-10-16 16:44:31, zijun_hu wrote: > On 10/12/2016 04:25 PM, Michal Hocko wrote: > > On Wed 12-10-16 15:24:33, zijun_hu wrote: [...] > >> i found the following code segments in mm/vmalloc.c > >> static struct vmap_area *alloc_vmap_area(unsigned long size, > >>

Re: [RFC PATCH 1/1] mm/percpu.c: fix memory leakage issue when allocate a odd alignment area

2016-10-12 Thread Michal Hocko
On Wed 12-10-16 15:24:33, zijun_hu wrote: > On 10/12/2016 02:53 PM, Michal Hocko wrote: > > On Wed 12-10-16 08:28:17, zijun_hu wrote: > >> On 2016/10/12 1:22, Michal Hocko wrote: > >>> On Tue 11-10-16 21:24:50, zijun_hu wrote: > From: zijun_hu > > the LSB of a

Re: [RFC PATCH 1/1] mm/percpu.c: fix memory leakage issue when allocate a odd alignment area

2016-10-12 Thread Michal Hocko
On Wed 12-10-16 15:24:33, zijun_hu wrote: > On 10/12/2016 02:53 PM, Michal Hocko wrote: > > On Wed 12-10-16 08:28:17, zijun_hu wrote: > >> On 2016/10/12 1:22, Michal Hocko wrote: > >>> On Tue 11-10-16 21:24:50, zijun_hu wrote: > From: zijun_hu > > the LSB of a chunk->map element is

Re: [RFC PATCH 1/1] mm/percpu.c: fix memory leakage issue when allocate a odd alignment area

2016-10-12 Thread zijun_hu
On 10/12/2016 04:25 PM, Michal Hocko wrote: > On Wed 12-10-16 15:24:33, zijun_hu wrote: >> On 10/12/2016 02:53 PM, Michal Hocko wrote: >>> On Wed 12-10-16 08:28:17, zijun_hu wrote: On 2016/10/12 1:22, Michal Hocko wrote: > On Tue 11-10-16 21:24:50, zijun_hu wrote: >> From: zijun_hu

Re: [RFC PATCH 1/1] mm/percpu.c: fix memory leakage issue when allocate a odd alignment area

2016-10-12 Thread zijun_hu
On 10/12/2016 04:25 PM, Michal Hocko wrote: > On Wed 12-10-16 15:24:33, zijun_hu wrote: >> On 10/12/2016 02:53 PM, Michal Hocko wrote: >>> On Wed 12-10-16 08:28:17, zijun_hu wrote: On 2016/10/12 1:22, Michal Hocko wrote: > On Tue 11-10-16 21:24:50, zijun_hu wrote: >> From: zijun_hu

Re: [RFC PATCH 1/1] mm/percpu.c: fix memory leakage issue when allocate a odd alignment area

2016-10-12 Thread zijun_hu
On 10/12/2016 02:53 PM, Michal Hocko wrote: > On Wed 12-10-16 08:28:17, zijun_hu wrote: >> On 2016/10/12 1:22, Michal Hocko wrote: >>> On Tue 11-10-16 21:24:50, zijun_hu wrote: From: zijun_hu the LSB of a chunk->map element is used for free/in-use flag of a area

Re: [RFC PATCH 1/1] mm/percpu.c: fix memory leakage issue when allocate a odd alignment area

2016-10-12 Thread zijun_hu
On 10/12/2016 02:53 PM, Michal Hocko wrote: > On Wed 12-10-16 08:28:17, zijun_hu wrote: >> On 2016/10/12 1:22, Michal Hocko wrote: >>> On Tue 11-10-16 21:24:50, zijun_hu wrote: From: zijun_hu the LSB of a chunk->map element is used for free/in-use flag of a area and the other

Re: [RFC PATCH 1/1] mm/percpu.c: fix memory leakage issue when allocate a odd alignment area

2016-10-12 Thread zijun_hu
On 10/12/2016 02:53 PM, Michal Hocko wrote: > On Wed 12-10-16 08:28:17, zijun_hu wrote: >> On 2016/10/12 1:22, Michal Hocko wrote: >>> On Tue 11-10-16 21:24:50, zijun_hu wrote: From: zijun_hu the LSB of a chunk->map element is used for free/in-use flag of a area

Re: [RFC PATCH 1/1] mm/percpu.c: fix memory leakage issue when allocate a odd alignment area

2016-10-12 Thread zijun_hu
On 10/12/2016 02:53 PM, Michal Hocko wrote: > On Wed 12-10-16 08:28:17, zijun_hu wrote: >> On 2016/10/12 1:22, Michal Hocko wrote: >>> On Tue 11-10-16 21:24:50, zijun_hu wrote: From: zijun_hu the LSB of a chunk->map element is used for free/in-use flag of a area and the other

Re: [RFC PATCH 1/1] mm/percpu.c: fix memory leakage issue when allocate a odd alignment area

2016-10-12 Thread Michal Hocko
On Wed 12-10-16 08:28:17, zijun_hu wrote: > On 2016/10/12 1:22, Michal Hocko wrote: > > On Tue 11-10-16 21:24:50, zijun_hu wrote: > >> From: zijun_hu > >> > >> the LSB of a chunk->map element is used for free/in-use flag of a area > >> and the other bits for offset, the

Re: [RFC PATCH 1/1] mm/percpu.c: fix memory leakage issue when allocate a odd alignment area

2016-10-12 Thread Michal Hocko
On Wed 12-10-16 08:28:17, zijun_hu wrote: > On 2016/10/12 1:22, Michal Hocko wrote: > > On Tue 11-10-16 21:24:50, zijun_hu wrote: > >> From: zijun_hu > >> > >> the LSB of a chunk->map element is used for free/in-use flag of a area > >> and the other bits for offset, the sufficient and necessary

Re: [RFC PATCH 1/1] mm/percpu.c: fix memory leakage issue when allocate a odd alignment area

2016-10-11 Thread zijun_hu
On 2016/10/12 1:22, Michal Hocko wrote: > On Tue 11-10-16 21:24:50, zijun_hu wrote: >> From: zijun_hu >> >> the LSB of a chunk->map element is used for free/in-use flag of a area >> and the other bits for offset, the sufficient and necessary condition of >> this usage is that

Re: [RFC PATCH 1/1] mm/percpu.c: fix memory leakage issue when allocate a odd alignment area

2016-10-11 Thread zijun_hu
On 2016/10/12 1:22, Michal Hocko wrote: > On Tue 11-10-16 21:24:50, zijun_hu wrote: >> From: zijun_hu >> >> the LSB of a chunk->map element is used for free/in-use flag of a area >> and the other bits for offset, the sufficient and necessary condition of >> this usage is that both size and

Re: [RFC PATCH 1/1] mm/percpu.c: fix memory leakage issue when allocate a odd alignment area

2016-10-11 Thread Michal Hocko
On Tue 11-10-16 21:24:50, zijun_hu wrote: > From: zijun_hu > > the LSB of a chunk->map element is used for free/in-use flag of a area > and the other bits for offset, the sufficient and necessary condition of > this usage is that both size and alignment of a area must be even

Re: [RFC PATCH 1/1] mm/percpu.c: fix memory leakage issue when allocate a odd alignment area

2016-10-11 Thread Michal Hocko
On Tue 11-10-16 21:24:50, zijun_hu wrote: > From: zijun_hu > > the LSB of a chunk->map element is used for free/in-use flag of a area > and the other bits for offset, the sufficient and necessary condition of > this usage is that both size and alignment of a area must be even numbers > however,

[RFC PATCH 1/1] mm/percpu.c: fix memory leakage issue when allocate a odd alignment area

2016-10-11 Thread zijun_hu
From: zijun_hu the LSB of a chunk->map element is used for free/in-use flag of a area and the other bits for offset, the sufficient and necessary condition of this usage is that both size and alignment of a area must be even numbers however, pcpu_alloc() doesn't force its

[RFC PATCH 1/1] mm/percpu.c: fix memory leakage issue when allocate a odd alignment area

2016-10-11 Thread zijun_hu
From: zijun_hu the LSB of a chunk->map element is used for free/in-use flag of a area and the other bits for offset, the sufficient and necessary condition of this usage is that both size and alignment of a area must be even numbers however, pcpu_alloc() doesn't force its @align parameter a even