public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Dong Aisheng <b29396@freescale.com>
To: Thomas Gleixner <tglx@linutronix.de>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-arm-kernel@lists.infradead.org" 
	<linux-arm-kernel@lists.infradead.org>,
	"grant.likely@secretlab.ca" <grant.likely@secretlab.ca>,
	"benh@kernel.crashing.org" <benh@kernel.crashing.org>
Subject: Re: [RFC PATCH 2/2] irq: add irq_desc_initialize to remove some duplicated lines
Date: Thu, 12 Jul 2012 11:26:25 +0800	[thread overview]
Message-ID: <20120712032624.GC22640@shlinux2.ap.freescale.net> (raw)
In-Reply-To: <alpine.LFD.2.02.1207120017590.32033@ionos>

Hi Thomas,

Thanks for the review firstly.

On Thu, Jul 12, 2012 at 06:19:18AM +0800, Thomas Gleixner wrote:
> On Wed, 20 Jun 2012, Dong Aisheng wrote:
> > From: Dong Aisheng <dong.aisheng@linaro.org>
> > 
> > There're two copies of irq_desc initialization code, reform them into
> > an irq_desc_initialize function to call.
> > 
> > Signed-off-by: Dong Aisheng <dong.aisheng@linaro.org>
> > ---
> >  kernel/irq/irqdesc.c |   51 +++++++++++++++++++++++++++----------------------
> >  1 files changed, 28 insertions(+), 23 deletions(-)
> 
> We add more code by removing redundant copies?
> 
I also had this strange question.
I looked the code a bit more, i guess the main problem is that the redundant copies
is not too big, so we can not see great savings.

Compare to the init code of irq_desc in original alloc_desc function,
the new irq_desc_initialize function saves 4 lines.
However, the new function also add 4 lines for defining extra function name,
parameter and etc.
And alloc_desc still needs to call irq_desc_initialize and checking return value
which needs extra 6 lines.
The main saving is another copy of irq_desc initialization in early_irq_init,
but this copy does not check any return values which cause we did not save too much,
only about 4 lines.
Plus extra blan lines added, so totally it does not save more than new added.

However, i was thinking it could make code looks a bit better.
So i sent out this RFC patch.
Do you think if it's reasonable?

BTW, there's an issue in my patch, should change like:
        if (alloc_masks(desc, GFP_KERNEL, node)) {
-               kfree(desc->kstat_irqs);
+               free_percpu(desc->kstat_irqs);
                return -ENOMEM;
        }

Regards
Dong Aisheng


  reply	other threads:[~2012-07-12  3:36 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-20  9:00 [RFC PATCH 1/2] irq_domain: correct a minor wrong comment for linear revmap Dong Aisheng
2012-06-20  9:00 ` [RFC PATCH 2/2] irq: add irq_desc_initialize to remove some duplicated lines Dong Aisheng
2012-07-06  9:18   ` Dong Aisheng
2012-07-11 22:19   ` Thomas Gleixner
2012-07-12  3:26     ` Dong Aisheng [this message]
2012-07-11 14:07 ` [RFC PATCH 1/2] irq_domain: correct a minor wrong comment for linear revmap Grant Likely

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=20120712032624.GC22640@shlinux2.ap.freescale.net \
    --to=b29396@freescale.com \
    --cc=benh@kernel.crashing.org \
    --cc=grant.likely@secretlab.ca \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tglx@linutronix.de \
    /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