From: Wanpeng Li <liwanp@linux.vnet.ibm.com>
To: Dave Hansen <dave.hansen@intel.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Rik van Riel <riel@redhat.com>,
Dave Hansen <dave.hansen@linux.intel.com>,
Fengguang Wu <fengguang.wu@intel.com>,
Joonsoo Kim <iamjoonsoo.kim@lge.com>,
Johannes Weiner <hannes@cmpxchg.org>, Tejun Heo <tj@kernel.org>,
Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>,
David Rientjes <rientjes@google.com>,
KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>,
Jiri Kosina <jkosina@suse.cz>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/4] mm/pgtable: Fix continue to preallocate pmds even if failure occurrence
Date: Fri, 16 Aug 2013 07:47:57 +0800 [thread overview]
Message-ID: <20130815234757.GA9879@hacker.(null)> (raw)
In-Reply-To: <520D160A.10405@intel.com>
Hi Dave,
On Thu, Aug 15, 2013 at 10:55:22AM -0700, Dave Hansen wrote:
>On 08/14/2013 05:31 PM, Wanpeng Li wrote:
>> preallocate_pmds will continue to preallocate pmds even if failure
>> occurrence, and then free all the preallocate pmds if there is
>> failure, this patch fix it by stop preallocate if failure occurrence
>> and go to free path.
>
>I guess there are a billion ways to do this, but I'm not sure we even
>need 'failed':
>
>--- arch/x86/mm/pgtable.c.orig 2013-08-15 10:52:15.145615027 -0700
>+++ arch/x86/mm/pgtable.c 2013-08-15 10:52:47.509614081 -0700
>@@ -196,21 +196,18 @@
> static int preallocate_pmds(pmd_t *pmds[])
> {
> int i;
>- bool failed = false;
>
> for(i = 0; i < PREALLOCATED_PMDS; i++) {
> pmd_t *pmd = (pmd_t *)__get_free_page(PGALLOC_GFP);
> if (pmd == NULL)
>- failed = true;
>+ goto err;
> pmds[i] = pmd;
> }
>
>- if (failed) {
>- free_pmds(pmds);
>- return -ENOMEM;
>- }
>-
> return 0;
>+err:
>+ free_pmds(pmds);
>+ return -ENOMEM;
> }
>
Thanks for your review, I will fold above to my patch. ;-)
Regards,
Wanpeng Li
>I don't have a problem with what you have, though. It's better than
>what was there, so:
>
>Reviewed-by: Dave Hansen <dave.hansen@linux.intel.com>
>
>--
>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>
--
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:[~2013-08-15 23:48 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-15 0:31 [PATCH 1/4] mm/pgtable: Fix continue to preallocate pmds even if failure occurrence Wanpeng Li
2013-08-15 0:31 ` [PATCH 2/4] mm/sparse: introduce alloc_usemap_and_memmap Wanpeng Li
2013-08-15 18:03 ` Dave Hansen
2013-08-16 0:08 ` Wanpeng Li
2013-08-16 0:08 ` Wanpeng Li
2013-08-15 0:31 ` [PATCH 3/4] mm/writeback: make writeback_inodes_wb static Wanpeng Li
2013-08-15 0:31 ` [PATCH 4/4] mm/vmalloc: use wrapper function get_vm_area_size to caculate size of vm area Wanpeng Li
2013-08-15 18:07 ` Dave Hansen
2013-08-15 23:49 ` Wanpeng Li
2013-08-15 23:49 ` Wanpeng Li
2013-08-15 17:55 ` [PATCH 1/4] mm/pgtable: Fix continue to preallocate pmds even if failure occurrence Dave Hansen
2013-08-15 23:47 ` Wanpeng Li [this message]
2013-08-15 23:47 ` Wanpeng Li
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='20130815234757.GA9879@hacker.(null)' \
--to=liwanp@linux.vnet.ibm.com \
--cc=akpm@linux-foundation.org \
--cc=dave.hansen@intel.com \
--cc=dave.hansen@linux.intel.com \
--cc=fengguang.wu@intel.com \
--cc=hannes@cmpxchg.org \
--cc=iamjoonsoo.kim@lge.com \
--cc=isimatu.yasuaki@jp.fujitsu.com \
--cc=jkosina@suse.cz \
--cc=kosaki.motohiro@jp.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=riel@redhat.com \
--cc=rientjes@google.com \
--cc=tj@kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).