* [PATCH 1/1] Trivial: Eliminate the ret variable from mm_take_all_locks
@ 2011-09-13 10:25 Kautuk Consul
2011-09-20 7:14 ` Michal Hocko
0 siblings, 1 reply; 3+ messages in thread
From: Kautuk Consul @ 2011-09-13 10:25 UTC (permalink / raw)
To: Andrew Morton, Hugh Dickins, Peter Zijlstra, Andrea Arcangeli,
Shaohua Li, Jiri Kosina
Cc: linux-mm, linux-kernel, Kautuk Consul
The ret variable is really not needed in mm_take_all_locks as per
the current flow of the mm_take_all_locks function.
So, eliminating this return variable.
Signed-off-by: Kautuk Consul <consul.kautuk@gmail.com>
---
mm/mmap.c | 8 +++-----
1 files changed, 3 insertions(+), 5 deletions(-)
diff --git a/mm/mmap.c b/mm/mmap.c
index a65efd4..48bc056 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -2558,7 +2558,6 @@ int mm_take_all_locks(struct mm_struct *mm)
{
struct vm_area_struct *vma;
struct anon_vma_chain *avc;
- int ret = -EINTR;
BUG_ON(down_read_trylock(&mm->mmap_sem));
@@ -2579,13 +2578,12 @@ int mm_take_all_locks(struct mm_struct *mm)
vm_lock_anon_vma(mm, avc->anon_vma);
}
- ret = 0;
+ return 0;
out_unlock:
- if (ret)
- mm_drop_all_locks(mm);
+ mm_drop_all_locks(mm);
- return ret;
+ return -EINTR;
}
static void vm_unlock_anon_vma(struct anon_vma *anon_vma)
--
1.7.6
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 1/1] Trivial: Eliminate the ret variable from mm_take_all_locks
2011-09-13 10:25 [PATCH 1/1] Trivial: Eliminate the ret variable from mm_take_all_locks Kautuk Consul
@ 2011-09-20 7:14 ` Michal Hocko
2011-09-21 3:39 ` kautuk.c @samsung.com
0 siblings, 1 reply; 3+ messages in thread
From: Michal Hocko @ 2011-09-20 7:14 UTC (permalink / raw)
To: Kautuk Consul
Cc: Andrew Morton, Hugh Dickins, Peter Zijlstra, Andrea Arcangeli,
Shaohua Li, Jiri Kosina, linux-mm, linux-kernel
On Tue 13-09-11 15:55:31, Kautuk Consul wrote:
> The ret variable is really not needed in mm_take_all_locks as per
> the current flow of the mm_take_all_locks function.
>
> So, eliminating this return variable.
>
> Signed-off-by: Kautuk Consul <consul.kautuk@gmail.com>
The compiled code seems to be very same - compilers are clever enough to
reorganize the code but anyway the code reads better this way.
Reviewed-by: Michal Hocko <mhocko@suse.cz>
> ---
> mm/mmap.c | 8 +++-----
> 1 files changed, 3 insertions(+), 5 deletions(-)
>
> diff --git a/mm/mmap.c b/mm/mmap.c
> index a65efd4..48bc056 100644
> --- a/mm/mmap.c
> +++ b/mm/mmap.c
> @@ -2558,7 +2558,6 @@ int mm_take_all_locks(struct mm_struct *mm)
> {
> struct vm_area_struct *vma;
> struct anon_vma_chain *avc;
> - int ret = -EINTR;
>
> BUG_ON(down_read_trylock(&mm->mmap_sem));
>
> @@ -2579,13 +2578,12 @@ int mm_take_all_locks(struct mm_struct *mm)
> vm_lock_anon_vma(mm, avc->anon_vma);
> }
>
> - ret = 0;
> + return 0;
>
> out_unlock:
> - if (ret)
> - mm_drop_all_locks(mm);
> + mm_drop_all_locks(mm);
>
> - return ret;
> + return -EINTR;
> }
>
> static void vm_unlock_anon_vma(struct anon_vma *anon_vma)
> --
> 1.7.6
>
> --
> To unsubscribe, send a message with 'unsubscribe linux-mm' in
> the body to majordomo@kvack.org. For more info on Linux MM,
> see: http://www.linux-mm.org/ .
> Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
> Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
--
Michal Hocko
SUSE Labs
SUSE LINUX s.r.o.
Lihovarska 1060/12
190 00 Praha 9
Czech Republic
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 1/1] Trivial: Eliminate the ret variable from mm_take_all_locks
2011-09-20 7:14 ` Michal Hocko
@ 2011-09-21 3:39 ` kautuk.c @samsung.com
0 siblings, 0 replies; 3+ messages in thread
From: kautuk.c @samsung.com @ 2011-09-21 3:39 UTC (permalink / raw)
To: Michal Hocko
Cc: Andrew Morton, Hugh Dickins, Peter Zijlstra, Andrea Arcangeli,
Shaohua Li, Jiri Kosina, linux-mm, linux-kernel
Thanks, Michal.
On Tue, Sep 20, 2011 at 12:44 PM, Michal Hocko <mhocko@suse.cz> wrote:
> On Tue 13-09-11 15:55:31, Kautuk Consul wrote:
>> The ret variable is really not needed in mm_take_all_locks as per
>> the current flow of the mm_take_all_locks function.
>>
>> So, eliminating this return variable.
>>
>> Signed-off-by: Kautuk Consul <consul.kautuk@gmail.com>
>
> The compiled code seems to be very same - compilers are clever enough to
> reorganize the code but anyway the code reads better this way.
>
> Reviewed-by: Michal Hocko <mhocko@suse.cz>
>
>> ---
>> mm/mmap.c | 8 +++-----
>> 1 files changed, 3 insertions(+), 5 deletions(-)
>>
>> diff --git a/mm/mmap.c b/mm/mmap.c
>> index a65efd4..48bc056 100644
>> --- a/mm/mmap.c
>> +++ b/mm/mmap.c
>> @@ -2558,7 +2558,6 @@ int mm_take_all_locks(struct mm_struct *mm)
>> {
>> struct vm_area_struct *vma;
>> struct anon_vma_chain *avc;
>> - int ret = -EINTR;
>>
>> BUG_ON(down_read_trylock(&mm->mmap_sem));
>>
>> @@ -2579,13 +2578,12 @@ int mm_take_all_locks(struct mm_struct *mm)
>> vm_lock_anon_vma(mm, avc->anon_vma);
>> }
>>
>> - ret = 0;
>> + return 0;
>>
>> out_unlock:
>> - if (ret)
>> - mm_drop_all_locks(mm);
>> + mm_drop_all_locks(mm);
>>
>> - return ret;
>> + return -EINTR;
>> }
>>
>> static void vm_unlock_anon_vma(struct anon_vma *anon_vma)
>> --
>> 1.7.6
>>
>> --
>> To unsubscribe, send a message with 'unsubscribe linux-mm' in
>> the body to majordomo@kvack.org. For more info on Linux MM,
>> see: http://www.linux-mm.org/ .
>> Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
>> Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
>
> --
> Michal Hocko
> SUSE Labs
> SUSE LINUX s.r.o.
> Lihovarska 1060/12
> 190 00 Praha 9
> Czech Republic
>
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-09-21 3:39 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-09-13 10:25 [PATCH 1/1] Trivial: Eliminate the ret variable from mm_take_all_locks Kautuk Consul
2011-09-20 7:14 ` Michal Hocko
2011-09-21 3:39 ` kautuk.c @samsung.com
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).