Re: [PATCH] mm: mmap: Check all failures before set values

2015-08-25 Thread Chen Gang
On 8/25/15 19:35, Michal Hocko wrote: > > OK, I guess I understand what you mean. You are certainly right that a > partial initialization for the failure case is not nice in general. I > was just objecting that the callers are supposed to free the vma in > the failure case so any partial

Re: [PATCH] mm: mmap: Check all failures before set values

2015-08-25 Thread Michal Hocko
On Tue 25-08-15 05:54:00, Chen Gang wrote: > On 8/24/15 21:57, Michal Hocko wrote: > > On Mon 24-08-15 21:34:25, Chen Gang wrote: > > [...] > > > >> It is always a little better to let the external function suppose fewer > >> callers' behalf. > > > > I am sorry but I do not understand what you

Re: [PATCH] mm: mmap: Check all failures before set values

2015-08-25 Thread Michal Hocko
On Tue 25-08-15 05:54:00, Chen Gang wrote: On 8/24/15 21:57, Michal Hocko wrote: On Mon 24-08-15 21:34:25, Chen Gang wrote: [...] It is always a little better to let the external function suppose fewer callers' behalf. I am sorry but I do not understand what you are saying here.

Re: [PATCH] mm: mmap: Check all failures before set values

2015-08-25 Thread Chen Gang
On 8/25/15 19:35, Michal Hocko wrote: OK, I guess I understand what you mean. You are certainly right that a partial initialization for the failure case is not nice in general. I was just objecting that the callers are supposed to free the vma in the failure case so any partial initialization

Re: [PATCH] mm: mmap: Check all failures before set values

2015-08-24 Thread Chen Gang
On 8/25/15 05:25, Andrew Morton wrote: > On Mon, 24 Aug 2015 13:32:13 +0200 Michal Hocko wrote: > >> On Mon 24-08-15 00:59:39, gang.chen.5...@qq.com wrote: >>> From: Chen Gang >>> >>> When failure occurs and return, vma->vm_pgoff is already set, which is >>> not a good idea. >> >> Why? The vma

Re: [PATCH] mm: mmap: Check all failures before set values

2015-08-24 Thread Andrew Morton
On Mon, 24 Aug 2015 13:32:13 +0200 Michal Hocko wrote: > On Mon 24-08-15 00:59:39, gang.chen.5...@qq.com wrote: > > From: Chen Gang > > > > When failure occurs and return, vma->vm_pgoff is already set, which is > > not a good idea. > > Why? The vma is not inserted anywhere and the failure

Re: [PATCH] mm: mmap: Check all failures before set values

2015-08-24 Thread Michal Hocko
On Mon 24-08-15 21:34:25, Chen Gang wrote: > On 8/24/15 19:32, Michal Hocko wrote: > > On Mon 24-08-15 00:59:39, gang.chen.5...@qq.com wrote: > >>> From: Chen Gang > >>> > >>> When failure occurs and return, vma->vm_pgoff is already set, which is > >>> not a good idea. > > Why? The vma is not

Re: [PATCH] mm: mmap: Check all failures before set values

2015-08-24 Thread Chen Gang
On 8/24/15 19:32, Michal Hocko wrote: > On Mon 24-08-15 00:59:39, gang.chen.5...@qq.com wrote: >>> From: Chen Gang >>> >>> When failure occurs and return, vma->vm_pgoff is already set, which is >>> not a good idea. > Why? The vma is not inserted anywhere and the failure path is supposed > to

Re: [PATCH] mm: mmap: Check all failures before set values

2015-08-24 Thread Michal Hocko
On Mon 24-08-15 00:59:39, gang.chen.5...@qq.com wrote: > From: Chen Gang > > When failure occurs and return, vma->vm_pgoff is already set, which is > not a good idea. Why? The vma is not inserted anywhere and the failure path is supposed to simply free the vma. > Signed-off-by: Chen Gang >

Re: [PATCH] mm: mmap: Check all failures before set values

2015-08-24 Thread Chen Gang
On 8/24/15 19:32, Michal Hocko wrote: On Mon 24-08-15 00:59:39, gang.chen.5...@qq.com wrote: From: Chen Gang gang.chen.5...@gmail.com When failure occurs and return, vma-vm_pgoff is already set, which is not a good idea. Why? The vma is not inserted anywhere and the failure path is supposed

Re: [PATCH] mm: mmap: Check all failures before set values

2015-08-24 Thread Michal Hocko
On Mon 24-08-15 21:34:25, Chen Gang wrote: On 8/24/15 19:32, Michal Hocko wrote: On Mon 24-08-15 00:59:39, gang.chen.5...@qq.com wrote: From: Chen Gang gang.chen.5...@gmail.com When failure occurs and return, vma-vm_pgoff is already set, which is not a good idea. Why? The vma is not

Re: [PATCH] mm: mmap: Check all failures before set values

2015-08-24 Thread Michal Hocko
On Mon 24-08-15 00:59:39, gang.chen.5...@qq.com wrote: From: Chen Gang gang.chen.5...@gmail.com When failure occurs and return, vma-vm_pgoff is already set, which is not a good idea. Why? The vma is not inserted anywhere and the failure path is supposed to simply free the vma.

Re: [PATCH] mm: mmap: Check all failures before set values

2015-08-24 Thread Chen Gang
On 8/25/15 05:25, Andrew Morton wrote: On Mon, 24 Aug 2015 13:32:13 +0200 Michal Hocko mho...@kernel.org wrote: On Mon 24-08-15 00:59:39, gang.chen.5...@qq.com wrote: From: Chen Gang gang.chen.5...@gmail.com When failure occurs and return, vma-vm_pgoff is already set, which is not a good

Re: [PATCH] mm: mmap: Check all failures before set values

2015-08-24 Thread Andrew Morton
On Mon, 24 Aug 2015 13:32:13 +0200 Michal Hocko mho...@kernel.org wrote: On Mon 24-08-15 00:59:39, gang.chen.5...@qq.com wrote: From: Chen Gang gang.chen.5...@gmail.com When failure occurs and return, vma-vm_pgoff is already set, which is not a good idea. Why? The vma is not inserted

[PATCH] mm: mmap: Check all failures before set values

2015-08-23 Thread Chen Gang
When failure occurs and return, vma->vm_pgoff is already set, which is not a good idea. Signed-off-by: Chen Gang ---  mm/mmap.c | 13 +++--  1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/mm/mmap.c b/mm/mmap.c index 8e0366e..b5a6f09 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@

[PATCH] mm: mmap: Check all failures before set values

2015-08-23 Thread Chen Gang
When failure occurs and return, vma-vm_pgoff is already set, which is not a good idea. Signed-off-by: Chen Gang gang.chen.5...@gmail.com ---  mm/mmap.c | 13 +++--  1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/mm/mmap.c b/mm/mmap.c index 8e0366e..b5a6f09 100644 ---