From: Andrew Morton <akpm@linux-foundation.org>
To: "Kirill A. Shutemov" <kirill@shutemov.name>
Cc: Rasmus Villemoes <linux@rasmusvillemoes.dk>,
"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
Sasha Levin <sasha.levin@oracle.com>,
Cyrill Gorcunov <gorcunov@openvz.org>,
Roman Gushchin <klamm@yandex-team.ru>,
Hugh Dickins <hughd@google.com>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm/mmap.c: use while instead of if+goto
Date: Mon, 30 Mar 2015 14:58:21 -0700 [thread overview]
Message-ID: <20150330145821.ca638ac21a02564cb5c04a36@linux-foundation.org> (raw)
In-Reply-To: <20150330205413.GA4458@node.dhcp.inet.fi>
On Mon, 30 Mar 2015 23:54:13 +0300 "Kirill A. Shutemov" <kirill@shutemov.name> wrote:
> On Mon, Mar 30, 2015 at 09:40:35PM +0200, Rasmus Villemoes wrote:
> > The creators of the C language gave us the while keyword. Let's use
> > that instead of synthesizing it from if+goto.
> >
> > Made possible by 6597d783397a ("mm/mmap.c: replace find_vma_prepare()
> > with clearer find_vma_links()").
> >
> > Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
>
>
> Looks good, except both your plus-lines are over 80-characters long for no
> reason.
--- a/mm/mmap.c~mm-mmapc-use-while-instead-of-ifgoto-fix
+++ a/mm/mmap.c
@@ -1551,7 +1551,8 @@ unsigned long mmap_region(struct file *f
/* Clear old maps */
error = -ENOMEM;
- while (find_vma_links(mm, addr, addr + len, &prev, &rb_link, &rb_parent)) {
+ while (find_vma_links(mm, addr, addr + len, &prev, &rb_link,
+ &rb_parent)) {
if (do_munmap(mm, addr, len))
return -ENOMEM;
}
@@ -1569,7 +1570,8 @@ unsigned long mmap_region(struct file *f
/*
* Can we just expand an old mapping?
*/
- vma = vma_merge(mm, prev, addr, addr + len, vm_flags, NULL, file, pgoff, NULL);
+ vma = vma_merge(mm, prev, addr, addr + len, vm_flags, NULL, file, pgoff,
+ NULL);
if (vma)
goto out;
@@ -2737,7 +2739,8 @@ static unsigned long do_brk(unsigned lon
/*
* Clear old maps. this also does some error checking for us
*/
- while (find_vma_links(mm, addr, addr + len, &prev, &rb_link, &rb_parent)) {
+ while (find_vma_links(mm, addr, addr + len, &prev, &rb_link,
+ &rb_parent)) {
if (do_munmap(mm, addr, len))
return -ENOMEM;
}
I'm not sure it improves things a lot, but mmap.c has been pretty
careful about the 80-col thing...
--
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/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2015-03-30 21:58 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-30 19:40 [PATCH] mm/mmap.c: use while instead of if+goto Rasmus Villemoes
2015-03-30 20:54 ` Kirill A. Shutemov
2015-03-30 21:58 ` Andrew Morton [this message]
2015-03-31 10:01 ` Rasmus Villemoes
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150330145821.ca638ac21a02564cb5c04a36@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=gorcunov@openvz.org \
--cc=hughd@google.com \
--cc=kirill.shutemov@linux.intel.com \
--cc=kirill@shutemov.name \
--cc=klamm@yandex-team.ru \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux@rasmusvillemoes.dk \
--cc=sasha.levin@oracle.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox