Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1219559 > unrolled thread
| Started by | Chen Gang <xili_gchen_5257@hotmail.com> |
|---|---|
| First post | 2015-09-05 16:10 +0200 |
| Last post | 2015-09-09 01:30 +0200 |
| Articles | 4 — 3 participants |
Back to article view | Back to linux.kernel
[PATCH] mm/mmap.c: Remove redundent 'get_area' function pointer in get_unmapped_area() Chen Gang <xili_gchen_5257@hotmail.com> - 2015-09-05 16:10 +0200
Re: [PATCH] mm/mmap.c: Remove redundent 'get_area' function pointer in get_unmapped_area() Oleg Nesterov <oleg@redhat.com> - 2015-09-07 14:50 +0200
Re: [PATCH] mm/mmap.c: Remove redundent 'get_area' function pointer in get_unmapped_area() Chen Gang <xili_gchen_5257@hotmail.com> - 2015-09-08 16:10 +0200
Re: [PATCH] mm/mmap.c: Remove redundent 'get_area' function pointer in get_unmapped_area() David Rientjes <rientjes@google.com> - 2015-09-09 01:30 +0200
| From | Chen Gang <xili_gchen_5257@hotmail.com> |
|---|---|
| Date | 2015-09-05 16:10 +0200 |
| Subject | [PATCH] mm/mmap.c: Remove redundent 'get_area' function pointer in get_unmapped_area() |
| Message-ID | <q5mki-2Hy-17@gated-at.bofh.it> |
From a1bf4726f71d6d0394b41309944646fc806a8a0c Mon Sep 17 00:00:00 2001
From: Chen Gang <gang.chen.5i5j@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.5i5j@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 majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [next] | [standalone]
| From | Oleg Nesterov <oleg@redhat.com> |
|---|---|
| Date | 2015-09-07 14:50 +0200 |
| Subject | Re: [PATCH] mm/mmap.c: Remove redundent 'get_area' function pointer in get_unmapped_area() |
| Message-ID | <q641Y-5PD-15@gated-at.bofh.it> |
| In reply to | #1219559 |
On 09/05, Chen Gang wrote:
>
> From a1bf4726f71d6d0394b41309944646fc806a8a0c Mon Sep 17 00:00:00 2001
> From: Chen Gang <gang.chen.5i5j@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.5i5j@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 majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Chen Gang <xili_gchen_5257@hotmail.com> |
|---|---|
| Date | 2015-09-08 16:10 +0200 |
| Subject | Re: [PATCH] mm/mmap.c: Remove redundent 'get_area' function pointer in get_unmapped_area() |
| Message-ID | <q6rKX-6sO-35@gated-at.bofh.it> |
| In reply to | #1219559 |
T24gOS83LzE1IDIwOjQxLCBPbGVnIE5lc3Rlcm92IHdyb3RlOgo+IE9uIDA5LzA1LCBDaGVuIEdh bmcgd3JvdGU6Cj4+Cj4+IEZyb20gYTFiZjQ3MjZmNzFkNmQwMzk0YjQxMzA5OTQ0NjQ2ZmM4MDZh OGEwYyBNb24gU2VwIDE3IDAwOjAwOjAwIDIwMDEKPj4gRnJvbTogQ2hlbiBHYW5nIDxnYW5nLmNo ZW4uNWk1akBnbWFpb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IGxlbiwKPj4gaWYg KGxlbj4gVEFTS19TSVpFKQo+PiByZXR1cm4gLUVOT01FTTsKPj4KPj4gLSBnZXRfYXJlYSA9IGN1 cnJlbnQtPm1tLT5nZXRfdW5tYXBwZWRfYXJlYTsKPj4gaWYgKGZpbGUgJiYgZmlsZS0+Zl9vcC0+ Z2V0X3VubWFwcGVkX2FyZWEpCj4+IC0gZ2V0X2FyZWEgPSBmaWxlLT5mX29wLT5nZXRfdW5tYXBw ZWRfYXJlYTsKPj4gLSBhZGRyID0gZ2V0X2FyZWEoZmlsZSwgYWRkciwgbGVuLCBwZ29mZiwgZmxh Z3MpOwo+PiArIGFkZHIgPSBmaWxlLT5mX29wLT5nZXRfdW5tYXBwZWRfYXJlYShmaWxlLCBhZGRy LCBsZW4sCj4+ICsgcGdvZmYsIGZsYWdzKTsKPj4gKyBlbHNlCj4+ICsgYWRkciA9IGN1cnJlbnQt Pm1tLT5nZXRfdW5tYXBwZWRfYXJlYShmaWxlLCBhZGRyLCBsZW4sCj4+ICsgcGdvZmYsIGZsYWdz KTsKPj4gaWYgKElTX0VSUl9WQUxVRShhZGRyKSkKPj4gcmV0dXJuIGFkZHI7Cj4+Cj4+IC0tCj4+ IDEuOS4zCj4+Cj4+Cj4KCi0tCkNoZW4gR2FuZyAos8K41SkKCk9wZW4sIHNoYXJlLCBhbmQgYXR0 aXR1ZGUgbGlrZSBhaXIsIHdhdGVyLCBhbmQgbGlmZSB3aGljaCBHb2QgYmxlc3NlZAogCQkgCSAg IAkJICA= -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | David Rientjes <rientjes@google.com> |
|---|---|
| Date | 2015-09-09 01:30 +0200 |
| Subject | Re: [PATCH] mm/mmap.c: Remove redundent 'get_area' function pointer in get_unmapped_area() |
| Message-ID | <q6AuR-2ah-7@gated-at.bofh.it> |
| In reply to | #1219559 |
On Sat, 5 Sep 2015, Chen Gang wrote: > > From a1bf4726f71d6d0394b41309944646fc806a8a0c Mon Sep 17 00:00:00 2001 > From: Chen Gang <gang.chen.5i5j@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.5i5j@gmail.com> Acked-by: David Rientjes <rientjes@google.com> -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web