Re: [PATCH] mm/mmap.c: Remove redundent 'get_area' function pointer in get_unmapped_area()

2015-09-11 Thread Chen Gang
On 9/11/15 06:32, Andrew Morton wrote:
> On Thu,  3 Sep 2015 12:14:51 +0800 gang.chen.5...@gmail.com wrote:
> 
> size(1) says this generates more object code.  And that probably means
> slightly worse code.  I didn't investigate, but probably the compiler
> is now preparing those five args at two different sites.
> 
> Which is pretty dumb of it - the compiler could have stacked the args
> first, then chosen the appropriate function to call.
> 

For get_unmapped_area() under x86_64, all 5 args are in registers, also
file->f_op->get_unmapped_area and current->mm->get_unmapped_area args
are same as get_unmapped_area(), which called directly (no new insns).

For me I am not quite sure which performance is better (So originally,
I said, "if orig code has a bit better performance, also if more than
20% taste orig code simple enough, we can keep it no touch").

 - New size is a little smaller than orig size.

 - But new insns is a little more than orig insns (x86_64 is not fix
   wide insns).

For me, I guess, new code is a bit better than orig code: for normal
sequence insns, 'size' is more important than insns count (at least, it
is more clearer than insns count).

The related dump (build by gcc6):

  [root@localhost mm]# size mmap.new.o
 text  data bss dec hex filename
17597   266  40   1790345ef mmap.new.o
  [root@localhost mm]# size mmap.orig.o
 text  data bss dec hex filename
17613   266  40   1791945ff mmap.orig.o

  objdump for mmap.orig.s:

04d0 :
 4d0:   55  push   %rbp
 4d1:   65 48 8b 04 25 00 00mov%gs:0x0,%rax
 4d8:   00 00 
 4da:   48 89 e5mov%rsp,%rbp
 4dd:   41 54   push   %r12
 4df:   53  push   %rbx
 4e0:   4c 8b 88 08 c0 ff ffmov-0x3ff8(%rax),%r9
 4e7:   48 b8 00 f0 ff ff ffmovabs $0x7000,%rax
 4ee:   7f 00 00 
 4f1:   41 f7 c1 00 00 00 20test   $0x2000,%r9d
 4f8:   74 1f   je 519 
 4fa:   65 48 8b 04 25 00 00mov%gs:0x0,%rax
 501:   00 00 
 503:   f6 80 cb 03 00 00 08testb  $0x8,0x3cb(%rax)
 50a:   41 b9 00 e0 ff ff   mov$0xe000,%r9d
 510:   b8 00 00 00 c0  mov$0xc000,%eax
 515:   49 0f 44 c1 cmove  %r9,%rax
 519:   48 39 d0cmp%rdx,%rax
 51c:   73 0f   jae52d 
 51e:   48 c7 c3 f4 ff ff ffmov$0xfff4,%rbx
 525:   48 89 d8mov%rbx,%rax
 528:   5b  pop%rbx
 529:   41 5c   pop%r12
 52b:   5d  pop%rbp
 52c:   c3  retq


 52d:   65 48 8b 04 25 00 00mov%gs:0x0,%rax
 534:   00 00 
 536:   48 8b 80 68 03 00 00mov0x368(%rax),%rax
 53d:   48 85 fftest   %rdi,%rdi
 540:   4c 8b 48 18 mov0x18(%rax),%r9
 544:   0f 84 82 00 00 00   je 5cc 
 54a:   48 8b 47 28 mov0x28(%rdi),%rax
 54e:   48 8b 80 98 00 00 00mov0x98(%rax),%rax
 555:   48 85 c0test   %rax,%rax
 558:   49 0f 44 c1 cmove  %r9,%rax
 55c:   49 89 d4mov%rdx,%r12
 55f:   ff d0   callq  *%rax
 561:   48 3d 00 f0 ff ff   cmp$0xf000,%rax
 567:   48 89 c3mov%rax,%rbx
 56a:   77 b9   ja 525 
 56c:   65 48 8b 04 25 00 00mov%gs:0x0,%rax
 573:   00 00 
 575:   48 8b 90 08 c0 ff ffmov-0x3ff8(%rax),%rdx
 57c:   48 b8 00 f0 ff ff ffmovabs $0x7000,%rax
 583:   7f 00 00 
 586:   f7 c2 00 00 00 20   test   $0x2000,%edx
 58c:   74 1e   je 5ac 
 58e:   65 48 8b 04 25 00 00mov%gs:0x0,%rax
 595:   00 00 
 597:   f6 80 cb 03 00 00 08testb  $0x8,0x3cb(%rax)
 59e:   ba 00 e0 ff ff  mov$0xe000,%edx
 5a3:   b8 00 00 00 c0  mov$0xc000,%eax
 5a8:   48 0f 44 c2 cmove  %rdx,%rax
 5ac:   4c 29 e0sub%r12,%rax
 5af:   48 39 c3cmp%rax,%rbx
 5b2:   0f 87 66 ff ff ff   ja 51e 
 5b8:   f7 c3 ff 0f 00 00   test   $0xfff,%ebx
 5be:   74 11   je 5d1 
 5c0:   

Re: [PATCH] mm/mmap.c: Remove redundent 'get_area' function pointer in get_unmapped_area()

2015-09-11 Thread Chen Gang
On 9/11/15 06:32, Andrew Morton wrote:
> On Thu,  3 Sep 2015 12:14:51 +0800 gang.chen.5...@gmail.com wrote:
> 
> size(1) says this generates more object code.  And that probably means
> slightly worse code.  I didn't investigate, but probably the compiler
> is now preparing those five args at two different sites.
> 
> Which is pretty dumb of it - the compiler could have stacked the args
> first, then chosen the appropriate function to call.
> 

For get_unmapped_area() under x86_64, all 5 args are in registers, also
file->f_op->get_unmapped_area and current->mm->get_unmapped_area args
are same as get_unmapped_area(), which called directly (no new insns).

For me I am not quite sure which performance is better (So originally,
I said, "if orig code has a bit better performance, also if more than
20% taste orig code simple enough, we can keep it no touch").

 - New size is a little smaller than orig size.

 - But new insns is a little more than orig insns (x86_64 is not fix
   wide insns).

For me, I guess, new code is a bit better than orig code: for normal
sequence insns, 'size' is more important than insns count (at least, it
is more clearer than insns count).

The related dump (build by gcc6):

  [root@localhost mm]# size mmap.new.o
 text  data bss dec hex filename
17597   266  40   1790345ef mmap.new.o
  [root@localhost mm]# size mmap.orig.o
 text  data bss dec hex filename
17613   266  40   1791945ff mmap.orig.o

  objdump for mmap.orig.s:

04d0 :
 4d0:   55  push   %rbp
 4d1:   65 48 8b 04 25 00 00mov%gs:0x0,%rax
 4d8:   00 00 
 4da:   48 89 e5mov%rsp,%rbp
 4dd:   41 54   push   %r12
 4df:   53  push   %rbx
 4e0:   4c 8b 88 08 c0 ff ffmov-0x3ff8(%rax),%r9
 4e7:   48 b8 00 f0 ff ff ffmovabs $0x7000,%rax
 4ee:   7f 00 00 
 4f1:   41 f7 c1 00 00 00 20test   $0x2000,%r9d
 4f8:   74 1f   je 519 
 4fa:   65 48 8b 04 25 00 00mov%gs:0x0,%rax
 501:   00 00 
 503:   f6 80 cb 03 00 00 08testb  $0x8,0x3cb(%rax)
 50a:   41 b9 00 e0 ff ff   mov$0xe000,%r9d
 510:   b8 00 00 00 c0  mov$0xc000,%eax
 515:   49 0f 44 c1 cmove  %r9,%rax
 519:   48 39 d0cmp%rdx,%rax
 51c:   73 0f   jae52d 
 51e:   48 c7 c3 f4 ff ff ffmov$0xfff4,%rbx
 525:   48 89 d8mov%rbx,%rax
 528:   5b  pop%rbx
 529:   41 5c   pop%r12
 52b:   5d  pop%rbp
 52c:   c3  retq


 52d:   65 48 8b 04 25 00 00mov%gs:0x0,%rax
 534:   00 00 
 536:   48 8b 80 68 03 00 00mov0x368(%rax),%rax
 53d:   48 85 fftest   %rdi,%rdi
 540:   4c 8b 48 18 mov0x18(%rax),%r9
 544:   0f 84 82 00 00 00   je 5cc 
 54a:   48 8b 47 28 mov0x28(%rdi),%rax
 54e:   48 8b 80 98 00 00 00mov0x98(%rax),%rax
 555:   48 85 c0test   %rax,%rax
 558:   49 0f 44 c1 cmove  %r9,%rax
 55c:   49 89 d4mov%rdx,%r12
 55f:   ff d0   callq  *%rax
 561:   48 3d 00 f0 ff ff   cmp$0xf000,%rax
 567:   48 89 c3mov%rax,%rbx
 56a:   77 b9   ja 525 
 56c:   65 48 8b 04 25 00 00mov%gs:0x0,%rax
 573:   00 00 
 575:   48 8b 90 08 c0 ff ffmov-0x3ff8(%rax),%rdx
 57c:   48 b8 00 f0 ff ff ffmovabs $0x7000,%rax
 583:   7f 00 00 
 586:   f7 c2 00 00 00 20   test   $0x2000,%edx
 58c:   74 1e   je 5ac 
 58e:   65 48 8b 04 25 00 00mov%gs:0x0,%rax
 595:   00 00 
 597:   f6 80 cb 03 00 00 08testb  $0x8,0x3cb(%rax)
 59e:   ba 00 e0 ff ff  mov$0xe000,%edx
 5a3:   b8 00 00 00 c0  mov$0xc000,%eax
 5a8:   48 0f 44 c2 cmove  %rdx,%rax
 5ac:   4c 29 e0sub%r12,%rax
 5af:   48 39 c3cmp%rax,%rbx
 5b2:   0f 87 66 ff ff ff   ja 51e 

Re: [PATCH] mm/mmap.c: Remove redundent 'get_area' function pointer in get_unmapped_area()

2015-09-10 Thread Andrew Morton
On Thu,  3 Sep 2015 12:14:51 +0800 gang.chen.5...@gmail.com wrote:

> From: Chen Gang 
> 
> Call the function pointer directly, then let code a bit simpler.
> 
> ...
>
> --- a/mm/mmap.c
> +++ b/mm/mmap.c
> @@ -2012,10 +2012,8 @@ unsigned long
>  get_unmapped_area(struct file *file, unsigned long addr, unsigned long len,
>   unsigned long pgoff, unsigned long flags)
>  {
> - unsigned long (*get_area)(struct file *, unsigned long,
> -   unsigned long, unsigned long, unsigned long);
> -
>   unsigned long error = arch_mmap_check(addr, len, flags);
> +
>   if (error)
>   return error;
>  
> @@ -2023,10 +2021,12 @@ get_unmapped_area(struct file *file, unsigned long 
> addr, unsigned long len,
>   if (len > TASK_SIZE)
>   return -ENOMEM;
>  
> - get_area = current->mm->get_unmapped_area;
>   if (file && file->f_op->get_unmapped_area)
> - get_area = file->f_op->get_unmapped_area;
> - addr = get_area(file, addr, len, pgoff, flags);
> + addr = file->f_op->get_unmapped_area(file, addr, len,
> + pgoff, flags);
> + else
> + addr = current->mm->get_unmapped_area(file, addr, len,
> + pgoff, flags);
>   if (IS_ERR_VALUE(addr))
>   return addr;

size(1) says this generates more object code.  And that probably means
slightly worse code.  I didn't investigate, but probably the compiler
is now preparing those five args at two different sites.

Which is pretty dumb of it - the compiler could have stacked the args
first, then chosen the appropriate function to call.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] mm/mmap.c: Remove redundent 'get_area' function pointer in get_unmapped_area()

2015-09-10 Thread Andrew Morton
On Thu,  3 Sep 2015 12:14:51 +0800 gang.chen.5...@gmail.com wrote:

> From: Chen Gang 
> 
> Call the function pointer directly, then let code a bit simpler.
> 
> ...
>
> --- a/mm/mmap.c
> +++ b/mm/mmap.c
> @@ -2012,10 +2012,8 @@ unsigned long
>  get_unmapped_area(struct file *file, unsigned long addr, unsigned long len,
>   unsigned long pgoff, unsigned long flags)
>  {
> - unsigned long (*get_area)(struct file *, unsigned long,
> -   unsigned long, unsigned long, unsigned long);
> -
>   unsigned long error = arch_mmap_check(addr, len, flags);
> +
>   if (error)
>   return error;
>  
> @@ -2023,10 +2021,12 @@ get_unmapped_area(struct file *file, unsigned long 
> addr, unsigned long len,
>   if (len > TASK_SIZE)
>   return -ENOMEM;
>  
> - get_area = current->mm->get_unmapped_area;
>   if (file && file->f_op->get_unmapped_area)
> - get_area = file->f_op->get_unmapped_area;
> - addr = get_area(file, addr, len, pgoff, flags);
> + addr = file->f_op->get_unmapped_area(file, addr, len,
> + pgoff, flags);
> + else
> + addr = current->mm->get_unmapped_area(file, addr, len,
> + pgoff, flags);
>   if (IS_ERR_VALUE(addr))
>   return addr;

size(1) says this generates more object code.  And that probably means
slightly worse code.  I didn't investigate, but probably the compiler
is now preparing those five args at two different sites.

Which is pretty dumb of it - the compiler could have stacked the args
first, then chosen the appropriate function to call.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] mm/mmap.c: Remove redundent 'get_area' function pointer in get_unmapped_area()

2015-09-08 Thread David Rientjes
On Sat, 5 Sep 2015, Chen Gang wrote:

> 
> From a1bf4726f71d6d0394b41309944646fc806a8a0c Mon Sep 17 00:00:00 2001
> From: Chen Gang 
> Date: Sat, 5 Sep 2015 21:51:08 +0800
> Subject: [PATCH] mm/mmap.c: Remove redundent 'get_area' function pointer in
> get_unmapped_area()
> 
> Call the function pointer directly, then let code a bit simpler.
> 
> Signed-off-by: Chen Gang 

Acked-by: David Rientjes 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] mm/mmap.c: Remove redundent 'get_area' function pointer in get_unmapped_area()

2015-09-08 Thread Chen Gang
On 9/7/15 20:41, Oleg Nesterov wrote:
> On 09/05, Chen Gang wrote:
>>
>> From a1bf4726f71d6d0394b41309944646fc806a8a0c Mon Sep 17 00:00:00 2001
>> From: Chen Gang 
>> Date: Sat, 5 Sep 2015 21:51:08 +0800
>> Subject: [PATCH] mm/mmap.c: Remove redundent 'get_area' function pointer in
>> get_unmapped_area()
>>
>> Call the function pointer directly, then let code a bit simpler.
> ^^
>
> This is subjective you know ;)
>

Oh, sorry. The comments need be improved.

> I guess the author of this code added this variable to make the code
> more readable. And to me it becomes less readable after your change.
>
> I leave this to you and maintainers.
>

OK, I can understand, every members have their own taste (my taste is
if one buffering variable is used within 2 times, I want to remove it).

For optimization, the original code maybe be a little better.

So for me, if more than 20% members still like the original code, we
should keep the original code no touch.


Thanks.

>> Signed-off-by: Chen Gang 
>> ---
>> mm/mmap.c | 12 ++--
>> 1 file changed, 6 insertions(+), 6 deletions(-)
>>
>> diff --git a/mm/mmap.c b/mm/mmap.c
>> index 4db7cf0..39fd727 100644
>> --- a/mm/mmap.c
>> +++ b/mm/mmap.c
>> @@ -2012,10 +2012,8 @@ unsigned long
>> get_unmapped_area(struct file *file, unsigned long addr, unsigned long len,
>> unsigned long pgoff, unsigned long flags)
>> {
>> - unsigned long (*get_area)(struct file *, unsigned long,
>> - unsigned long, unsigned long, unsigned long);
>> -
>> unsigned long error = arch_mmap_check(addr, len, flags);
>> +
>> if (error)
>> return error;
>>
>> @@ -2023,10 +2021,12 @@ get_unmapped_area(struct file *file, unsigned long 
>> addr, unsigned long len,
>> if (len> TASK_SIZE)
>> return -ENOMEM;
>>
>> - get_area = current->mm->get_unmapped_area;
>> if (file && file->f_op->get_unmapped_area)
>> - get_area = file->f_op->get_unmapped_area;
>> - addr = get_area(file, addr, len, pgoff, flags);
>> + addr = file->f_op->get_unmapped_area(file, addr, len,
>> + pgoff, flags);
>> + else
>> + addr = current->mm->get_unmapped_area(file, addr, len,
>> + pgoff, flags);
>> if (IS_ERR_VALUE(addr))
>> return addr;
>>
>> --
>> 1.9.3
>>
>>
>

--
Chen Gang (陈刚)

Open, share, and attitude like air, water, and life which God blessed
  

Re: [PATCH] mm/mmap.c: Remove redundent 'get_area' function pointer in get_unmapped_area()

2015-09-08 Thread Chen Gang
On 9/7/15 20:41, Oleg Nesterov wrote:
> On 09/05, Chen Gang wrote:
>>
>> From a1bf4726f71d6d0394b41309944646fc806a8a0c Mon Sep 17 00:00:00 2001
>> From: Chen Gang <gang.chen.5...@gmail.com>
>> Date: Sat, 5 Sep 2015 21:51:08 +0800
>> Subject: [PATCH] mm/mmap.c: Remove redundent 'get_area' function pointer in
>> get_unmapped_area()
>>
>> Call the function pointer directly, then let code a bit simpler.
> ^^
>
> This is subjective you know ;)
>

Oh, sorry. The comments need be improved.

> I guess the author of this code added this variable to make the code
> more readable. And to me it becomes less readable after your change.
>
> I leave this to you and maintainers.
>

OK, I can understand, every members have their own taste (my taste is
if one buffering variable is used within 2 times, I want to remove it).

For optimization, the original code maybe be a little better.

So for me, if more than 20% members still like the original code, we
should keep the original code no touch.


Thanks.

>> Signed-off-by: Chen Gang <gang.chen.5...@gmail.com>
>> ---
>> mm/mmap.c | 12 ++--
>> 1 file changed, 6 insertions(+), 6 deletions(-)
>>
>> diff --git a/mm/mmap.c b/mm/mmap.c
>> index 4db7cf0..39fd727 100644
>> --- a/mm/mmap.c
>> +++ b/mm/mmap.c
>> @@ -2012,10 +2012,8 @@ unsigned long
>> get_unmapped_area(struct file *file, unsigned long addr, unsigned long len,
>> unsigned long pgoff, unsigned long flags)
>> {
>> - unsigned long (*get_area)(struct file *, unsigned long,
>> - unsigned long, unsigned long, unsigned long);
>> -
>> unsigned long error = arch_mmap_check(addr, len, flags);
>> +
>> if (error)
>> return error;
>>
>> @@ -2023,10 +2021,12 @@ get_unmapped_area(struct file *file, unsigned long 
>> addr, unsigned long len,
>> if (len> TASK_SIZE)
>> return -ENOMEM;
>>
>> - get_area = current->mm->get_unmapped_area;
>> if (file && file->f_op->get_unmapped_area)
>> - get_area = file->f_op->get_unmapped_area;
>> - addr = get_area(file, addr, len, pgoff, flags);
>> + addr = file->f_op->get_unmapped_area(file, addr, len,
>> + pgoff, flags);
>> + else
>> + addr = current->mm->get_unmapped_area(file, addr, len,
>> + pgoff, flags);
>> if (IS_ERR_VALUE(addr))
>> return addr;
>>
>> --
>> 1.9.3
>>
>>
>

--
Chen Gang (陈刚)

Open, share, and attitude like air, water, and life which God blessed
  

Re: [PATCH] mm/mmap.c: Remove redundent 'get_area' function pointer in get_unmapped_area()

2015-09-08 Thread David Rientjes
On Sat, 5 Sep 2015, Chen Gang wrote:

> 
> From a1bf4726f71d6d0394b41309944646fc806a8a0c Mon Sep 17 00:00:00 2001
> From: Chen Gang <gang.chen.5...@gmail.com>
> Date: Sat, 5 Sep 2015 21:51:08 +0800
> Subject: [PATCH] mm/mmap.c: Remove redundent 'get_area' function pointer in
> get_unmapped_area()
> 
> Call the function pointer directly, then let code a bit simpler.
> 
> Signed-off-by: Chen Gang <gang.chen.5...@gmail.com>

Acked-by: David Rientjes <rient...@google.com>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] mm/mmap.c: Remove redundent 'get_area' function pointer in get_unmapped_area()

2015-09-07 Thread Oleg Nesterov
On 09/05, Chen Gang wrote:
>
> From a1bf4726f71d6d0394b41309944646fc806a8a0c Mon Sep 17 00:00:00 2001
> From: Chen Gang 
> Date: Sat, 5 Sep 2015 21:51:08 +0800
> Subject: [PATCH] mm/mmap.c: Remove redundent 'get_area' function pointer in
> get_unmapped_area()
>
> Call the function pointer directly, then let code a bit simpler.
   ^^

This is subjective you know ;)

I guess the author of this code added this variable to make the code
more readable. And to me it becomes less readable after your change.

I leave this to you and maintainers.

> Signed-off-by: Chen Gang 
> ---
>  mm/mmap.c | 12 ++--
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/mm/mmap.c b/mm/mmap.c
> index 4db7cf0..39fd727 100644
> --- a/mm/mmap.c
> +++ b/mm/mmap.c
> @@ -2012,10 +2012,8 @@ unsigned long
>  get_unmapped_area(struct file *file, unsigned long addr, unsigned long len,
>   unsigned long pgoff, unsigned long flags)
>  {
> - unsigned long (*get_area)(struct file *, unsigned long,
> -   unsigned long, unsigned long, unsigned long);
> -
>   unsigned long error = arch_mmap_check(addr, len, flags);
> +
>   if (error)
>   return error;
>  
> @@ -2023,10 +2021,12 @@ get_unmapped_area(struct file *file, unsigned long 
> addr, unsigned long len,
>   if (len> TASK_SIZE)
>   return -ENOMEM;
>  
> - get_area = current->mm->get_unmapped_area;
>   if (file && file->f_op->get_unmapped_area)
> - get_area = file->f_op->get_unmapped_area;
> - addr = get_area(file, addr, len, pgoff, flags);
> + addr = file->f_op->get_unmapped_area(file, addr, len,
> + pgoff, flags);
> + else
> + addr = current->mm->get_unmapped_area(file, addr, len,
> + pgoff, flags);
>   if (IS_ERR_VALUE(addr))
>   return addr;
>  
> -- 
> 1.9.3
> 
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] mm/mmap.c: Remove redundent 'get_area' function pointer in get_unmapped_area()

2015-09-07 Thread Oleg Nesterov
On 09/05, Chen Gang wrote:
>
> From a1bf4726f71d6d0394b41309944646fc806a8a0c Mon Sep 17 00:00:00 2001
> From: Chen Gang <gang.chen.5...@gmail.com>
> Date: Sat, 5 Sep 2015 21:51:08 +0800
> Subject: [PATCH] mm/mmap.c: Remove redundent 'get_area' function pointer in
> get_unmapped_area()
>
> Call the function pointer directly, then let code a bit simpler.
   ^^

This is subjective you know ;)

I guess the author of this code added this variable to make the code
more readable. And to me it becomes less readable after your change.

I leave this to you and maintainers.

> Signed-off-by: Chen Gang <gang.chen.5...@gmail.com>
> ---
>  mm/mmap.c | 12 ++--
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/mm/mmap.c b/mm/mmap.c
> index 4db7cf0..39fd727 100644
> --- a/mm/mmap.c
> +++ b/mm/mmap.c
> @@ -2012,10 +2012,8 @@ unsigned long
>  get_unmapped_area(struct file *file, unsigned long addr, unsigned long len,
>   unsigned long pgoff, unsigned long flags)
>  {
> - unsigned long (*get_area)(struct file *, unsigned long,
> -   unsigned long, unsigned long, unsigned long);
> -
>   unsigned long error = arch_mmap_check(addr, len, flags);
> +
>   if (error)
>   return error;
>  
> @@ -2023,10 +2021,12 @@ get_unmapped_area(struct file *file, unsigned long 
> addr, unsigned long len,
>   if (len> TASK_SIZE)
>   return -ENOMEM;
>  
> - get_area = current->mm->get_unmapped_area;
>   if (file && file->f_op->get_unmapped_area)
> - get_area = file->f_op->get_unmapped_area;
> - addr = get_area(file, addr, len, pgoff, flags);
> + addr = file->f_op->get_unmapped_area(file, addr, len,
> + pgoff, flags);
> + else
> + addr = current->mm->get_unmapped_area(file, addr, len,
> + pgoff, flags);
>   if (IS_ERR_VALUE(addr))
>   return addr;
>  
> -- 
> 1.9.3
> 
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] mm/mmap.c: Remove redundent 'get_area' function pointer in get_unmapped_area()

2015-09-05 Thread Chen Gang

>From a1bf4726f71d6d0394b41309944646fc806a8a0c Mon Sep 17 00:00:00 2001
From: Chen Gang 
Date: Sat, 5 Sep 2015 21:51:08 +0800
Subject: [PATCH] mm/mmap.c: Remove redundent 'get_area' function pointer in
get_unmapped_area()

Call the function pointer directly, then let code a bit simpler.

Signed-off-by: Chen Gang 
---
 mm/mmap.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/mm/mmap.c b/mm/mmap.c
index 4db7cf0..39fd727 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -2012,10 +2012,8 @@ unsigned long
 get_unmapped_area(struct file *file, unsigned long addr, unsigned long len,
    unsigned long pgoff, unsigned long flags)
 {
-   unsigned long (*get_area)(struct file *, unsigned long,
- unsigned long, unsigned long, unsigned long);
-
    unsigned long error = arch_mmap_check(addr, len, flags);
+
    if (error)
    return error;
 
@@ -2023,10 +2021,12 @@ get_unmapped_area(struct file *file, unsigned long 
addr, unsigned long len,
    if (len> TASK_SIZE)
    return -ENOMEM;
 
-   get_area = current->mm->get_unmapped_area;
    if (file && file->f_op->get_unmapped_area)
-   get_area = file->f_op->get_unmapped_area;
-   addr = get_area(file, addr, len, pgoff, flags);
+   addr = file->f_op->get_unmapped_area(file, addr, len,
+   pgoff, flags);
+   else
+   addr = current->mm->get_unmapped_area(file, addr, len,
+   pgoff, flags);
    if (IS_ERR_VALUE(addr))
    return addr;
 
-- 
1.9.3

  --
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] mm/mmap.c: Remove redundent 'get_area' function pointer in get_unmapped_area()

2015-09-05 Thread Chen Gang

>From a1bf4726f71d6d0394b41309944646fc806a8a0c Mon Sep 17 00:00:00 2001
From: Chen Gang <gang.chen.5...@gmail.com>
Date: Sat, 5 Sep 2015 21:51:08 +0800
Subject: [PATCH] mm/mmap.c: Remove redundent 'get_area' function pointer in
get_unmapped_area()

Call the function pointer directly, then let code a bit simpler.

Signed-off-by: Chen Gang <gang.chen.5...@gmail.com>
---
 mm/mmap.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/mm/mmap.c b/mm/mmap.c
index 4db7cf0..39fd727 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -2012,10 +2012,8 @@ unsigned long
 get_unmapped_area(struct file *file, unsigned long addr, unsigned long len,
    unsigned long pgoff, unsigned long flags)
 {
-   unsigned long (*get_area)(struct file *, unsigned long,
- unsigned long, unsigned long, unsigned long);
-
    unsigned long error = arch_mmap_check(addr, len, flags);
+
    if (error)
    return error;
 
@@ -2023,10 +2021,12 @@ get_unmapped_area(struct file *file, unsigned long 
addr, unsigned long len,
    if (len> TASK_SIZE)
    return -ENOMEM;
 
-   get_area = current->mm->get_unmapped_area;
    if (file && file->f_op->get_unmapped_area)
-   get_area = file->f_op->get_unmapped_area;
-   addr = get_area(file, addr, len, pgoff, flags);
+   addr = file->f_op->get_unmapped_area(file, addr, len,
+   pgoff, flags);
+   else
+   addr = current->mm->get_unmapped_area(file, addr, len,
+   pgoff, flags);
    if (IS_ERR_VALUE(addr))
    return addr;
 
-- 
1.9.3

  --
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] mm/mmap.c: Remove redundent 'get_area' function pointer in get_unmapped_area()

2015-09-02 Thread gang . chen . 5i5j
From: Chen Gang 

Call the function pointer directly, then let code a bit simpler.

Signed-off-by: Chen Gang 
---
 mm/mmap.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/mm/mmap.c b/mm/mmap.c
index 4db7cf0..39fd727 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -2012,10 +2012,8 @@ unsigned long
 get_unmapped_area(struct file *file, unsigned long addr, unsigned long len,
unsigned long pgoff, unsigned long flags)
 {
-   unsigned long (*get_area)(struct file *, unsigned long,
- unsigned long, unsigned long, unsigned long);
-
unsigned long error = arch_mmap_check(addr, len, flags);
+
if (error)
return error;
 
@@ -2023,10 +2021,12 @@ get_unmapped_area(struct file *file, unsigned long 
addr, unsigned long len,
if (len > TASK_SIZE)
return -ENOMEM;
 
-   get_area = current->mm->get_unmapped_area;
if (file && file->f_op->get_unmapped_area)
-   get_area = file->f_op->get_unmapped_area;
-   addr = get_area(file, addr, len, pgoff, flags);
+   addr = file->f_op->get_unmapped_area(file, addr, len,
+   pgoff, flags);
+   else
+   addr = current->mm->get_unmapped_area(file, addr, len,
+   pgoff, flags);
if (IS_ERR_VALUE(addr))
return addr;
 
-- 
1.9.3
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] mm/mmap.c: Remove redundent 'get_area' function pointer in get_unmapped_area()

2015-09-02 Thread gang . chen . 5i5j
From: Chen Gang 

Call the function pointer directly, then let code a bit simpler.

Signed-off-by: Chen Gang 
---
 mm/mmap.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/mm/mmap.c b/mm/mmap.c
index 4db7cf0..39fd727 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -2012,10 +2012,8 @@ unsigned long
 get_unmapped_area(struct file *file, unsigned long addr, unsigned long len,
unsigned long pgoff, unsigned long flags)
 {
-   unsigned long (*get_area)(struct file *, unsigned long,
- unsigned long, unsigned long, unsigned long);
-
unsigned long error = arch_mmap_check(addr, len, flags);
+
if (error)
return error;
 
@@ -2023,10 +2021,12 @@ get_unmapped_area(struct file *file, unsigned long 
addr, unsigned long len,
if (len > TASK_SIZE)
return -ENOMEM;
 
-   get_area = current->mm->get_unmapped_area;
if (file && file->f_op->get_unmapped_area)
-   get_area = file->f_op->get_unmapped_area;
-   addr = get_area(file, addr, len, pgoff, flags);
+   addr = file->f_op->get_unmapped_area(file, addr, len,
+   pgoff, flags);
+   else
+   addr = current->mm->get_unmapped_area(file, addr, len,
+   pgoff, flags);
if (IS_ERR_VALUE(addr))
return addr;
 
-- 
1.9.3
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/