From: Ingo Molnar <mingo@elte.hu>
To: David Rientjes <rientjes@google.com>
Cc: Yinghai Lu <yinghai@kernel.org>,
Cyrill Gorcunov <gorcunov@gmail.com>, Tejun Heo <tj@kernel.org>,
Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>,
tglx@linutronix.de, brgerst@gmail.com, shaohui.zheng@intel.com,
linux-kernel@vger.kernel.org
Subject: Re: [patch] x86, mm: Clean up initmem_init
Date: Fri, 4 Mar 2011 08:08:02 +0100 [thread overview]
Message-ID: <20110304070802.GA27618@elte.hu> (raw)
In-Reply-To: <alpine.DEB.2.00.1103031404510.4141@chino.kir.corp.google.com>
* David Rientjes <rientjes@google.com> wrote:
> On Thu, 3 Mar 2011, Yinghai Lu wrote:
>
> > he want
> >
> > > +#ifdef CONFIG_ACPI_NUMA
> > >> > + ret = numa_init(x86_acpi_numa_init);
> > >> > + if (!ret)
> > >> > + return;
> > >> > +#endif
> > >> > +#ifdef CONFIG_AMD_NUMA
> > >> > + ret = numa_init(amd_numa_init);
> > >> > + if (!ret)
> > >> > + return;
> > >> > +#endif
> >
> > to be replaced by:
> >
> > > +#ifdef CONFIG_ACPI_NUMA
> > >> > + if (!numa_init(x86_acpi_numa_init))
> > >> > + return;
> > >> > +#endif
> > >> > +#ifdef CONFIG_AMD_NUMA
> > >> > + if (!numa_init(amd_numa_init))
> > >> > + return;
> > >> > +#endif
>
> It's a matter of style and I think it's up to Ingo what he'd prefer to
> see.
I think your variant is cleaner: hiding function call side-effects in conditionscan
be a fragile thing to do. We want constant expressions with no side-effects - so if
functions are called they should be constant functions as well.
Code compactness isn't everything - if it was we'd be using C to the max to create
unreadable compound expressions all the time.
Thanks,
Ingo
next prev parent reply other threads:[~2011-03-04 7:08 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <tip-ffe77a4605fb2588f8666850ad3e3b196241658f@git.kernel.org>
2011-02-20 3:34 ` [tip:x86/mm] x86-64, NUMA: Restructure initmem_init() David Rientjes
2011-02-21 8:35 ` Tejun Heo
2011-03-03 21:15 ` [patch] x86, mm: Clean up initmem_init David Rientjes
2011-03-03 21:43 ` Cyrill Gorcunov
2011-03-03 22:00 ` David Rientjes
2011-03-03 22:03 ` Yinghai Lu
2011-03-03 22:05 ` Cyrill Gorcunov
2011-03-03 22:05 ` David Rientjes
2011-03-03 22:10 ` Cyrill Gorcunov
2011-03-04 7:08 ` Ingo Molnar [this message]
2011-03-04 12:38 ` Cyrill Gorcunov
2011-03-04 10:16 ` Tejun Heo
2011-03-04 14:19 ` [PATCH x86/mm] x86-64, NUMA: Clean up initmem_init() Tejun Heo
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=20110304070802.GA27618@elte.hu \
--to=mingo@elte.hu \
--cc=brgerst@gmail.com \
--cc=gorcunov@gmail.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=rientjes@google.com \
--cc=shaohui.zheng@intel.com \
--cc=tglx@linutronix.de \
--cc=tj@kernel.org \
--cc=yinghai@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