linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Michal Hocko <mhocko@suse.cz>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Jianyu Zhan <nasa4836@gmail.com>,
	iamjoonsoo.kim@lge.com, aneesh.kumar@linux.vnet.ibm.com,
	n-horiguchi@ah.jp.nec.com, aarcange@redhat.com,
	steve.capper@linaro.org, davidlohr@hp.com,
	kirill.shutemov@linux.intel.com, dave.hansen@linux.intel.com,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm, hugetlb: move the error handle logic out of normal code path
Date: Fri, 16 May 2014 09:57:30 +0200	[thread overview]
Message-ID: <20140516075730.GA22818@dhcp22.suse.cz> (raw)
In-Reply-To: <20140515153620.344fe054b6b8d054a28fbf82@linux-foundation.org>

On Thu 15-05-14 15:36:20, Andrew Morton wrote:
> On Thu, 15 May 2014 11:01:42 +0200 Michal Hocko <mhocko@suse.cz> wrote:
> 
> > On Wed 14-05-14 15:10:59, Jianyu Zhan wrote:
> > > alloc_huge_page() now mixes normal code path with error handle logic.
> > > This patches move out the error handle logic, to make normal code
> > > path more clean and redue code duplicate.
> > 
> > I don't know. Part of the function returns and cleans up on its own and
> > other part relies on clean up labels. This is not so much nicer than the
> > previous state.
> 
> That's actually a common pattern:
> 
> foo()
> {
> 	if (check which doesn't change any state)
> 		return -Efoo;
> 	if (another check which doesn't change any state)
> 		return -Ebar;
> 
> 	do_something_which_changes_state()
> 	
> 	if (another check)
> 		goto undo_that_state_chage;
> 	...
> 
> undo_that_state_change:
> 	...
> }

Right. I have misread the previous vma_needs_reservation and
hugepage_subpool_get_pages error path and already considered it as a
changing state one. Sorry about the confusion.
-- 
Michal Hocko
SUSE Labs

--
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>

  reply	other threads:[~2014-05-16  7:57 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-14  7:10 [PATCH] mm, hugetlb: move the error handle logic out of normal code path Jianyu Zhan
2014-05-15  9:01 ` Michal Hocko
2014-05-15 22:36   ` Andrew Morton
2014-05-16  7:57     ` Michal Hocko [this message]
2014-05-15 22:38 ` Davidlohr Bueso
2014-05-18 17:27 ` Aneesh Kumar K.V

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=20140516075730.GA22818@dhcp22.suse.cz \
    --to=mhocko@suse.cz \
    --cc=aarcange@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=aneesh.kumar@linux.vnet.ibm.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=davidlohr@hp.com \
    --cc=iamjoonsoo.kim@lge.com \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=n-horiguchi@ah.jp.nec.com \
    --cc=nasa4836@gmail.com \
    --cc=steve.capper@linaro.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).