From: Venki Pallipadi <venkatesh.pallipadi@intel.com>
To: Oleg Nesterov <oleg@tv-sign.ru>
Cc: Venki Pallipadi <venkatesh.pallipadi@intel.com>,
linux-kernel <linux-kernel@vger.kernel.org>,
akpm@linux-foundation.org, davej@codemonkey.org.uk,
johnstul@us.ibm.com, mingo@elte.hu, tglx@linutronix.de
Subject: Re: [PATCH] Add support for deferrable timers (respun)
Date: Tue, 27 Mar 2007 15:36:25 -0700 [thread overview]
Message-ID: <20070327223625.GA30923@linux-os.sc.intel.com> (raw)
In-Reply-To: <20070327222227.GA279@tv-sign.ru>
On Wed, Mar 28, 2007 at 02:22:27AM +0400, Oleg Nesterov wrote:
> On 03/27, Venki Pallipadi wrote:
> >
> > @@ -368,7 +368,7 @@
> >
> > for (;;) {
> > tvec_base_t *prelock_base = timer->base;
> > - base = timer_get_base(timer);
> > + base = tbase_get_base(prelock_base);
> > if (likely(base != NULL)) {
> > spin_lock_irqsave(&base->lock, *flags);
> > if (likely(prelock_base == timer->base))
>
> Looks correct to me... Personally, I'd prefer
>
> static tvec_base_t *lock_timer_base(struct timer_list *timer,
> unsigned long *flags)
> __acquires(timer->base->lock)
> {
> tvec_base_t *base;
>
> for (;;) {
> base = timer_get_base(timer);
> if (likely(base != NULL)) {
> spin_lock_irqsave(&base->lock, *flags);
> if (likely(base == timer_get_base(timer))
> return base;
> /* The timer has migrated to another CPU */
> spin_unlock_irqrestore(&base->lock, *flags);
> }
> cpu_relax();
> }
> }
>
> but this is a matter of taste.
I thought about this. But, chose the other one just to save one additional
'and' overhead.
>
> A minor nitpick,
>
> > +/* new_base is guaranteed to have last bit not set, in all callers below */
> > +static inline void timer_set_base(struct timer_list *timer,
> > + struct tvec_t_base_s *old_base,
> > + struct tvec_t_base_s *new_base)
> > +{
> > + timer->base = (struct tvec_t_base_s *)((unsigned long)(new_base) |
> > + tbase_get_deferrable(old_base));
> > +}
>
> looks a little bit ugly, but may be this is just me. How about
>
> void timer_set_base(struct timer_list *timer, struct tvec_t_base_s *new_base)
> {
> timer->base = (struct tvec_t_base_s *)
> ((unsigned long)(new_base) | tbase_get_deferrable(timer->base));
> }
>
> __mod_timer:
> - tvec_base_t *old_base = timer->base;
> - timer->base = NULL;
> + timer_set_base(timer, NULL);
>
> ?
I agree the above suggestion is clean. But, it will have one additional 'and'
operation when we set NULL. I saw some concern from Andrew earlier on overhead
this patch was adding.
>
> > + /* Make sure that tvec_base is 2 byte aligned */
> > + if (tbase_get_deferrable(base)) {
> > + WARN_ON(1);
> > + kfree(base);
> > + return -ENOMEM;
> > + }
>
> Not a comment, but a question: do we really need this?
AFAIK, kmalloc_node should return an even address always. I was just being
paranoid and wanted to assert it here as otherwise some normal timer may end up
being deferred timer.
Thanks,
Venki
next prev parent reply other threads:[~2007-03-27 22:37 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <200703212353.l2LNrNOj007453@shell0.pdx.osdl.net>
[not found] ` <20070322140532.GA120@tv-sign.ru>
[not found] ` <20070322151817.GA29840@linux-os.sc.intel.com>
[not found] ` <20070322161355.GA160@tv-sign.ru>
2007-03-27 20:43 ` [PATCH] Add support for deferrable timers (respun) Venki Pallipadi
2007-03-27 21:11 ` Oleg Nesterov
2007-03-27 21:55 ` Venki Pallipadi
2007-03-27 22:22 ` Oleg Nesterov
2007-03-27 22:28 ` Oleg Nesterov
2007-03-27 22:36 ` Venki Pallipadi [this message]
2007-03-28 23:00 ` [PATCH] Add support for deferrable timers (respun-Mar28) Venki Pallipadi
2007-03-29 0:01 ` Andrew Morton
2007-03-29 0:59 ` Venki Pallipadi
2007-03-29 11:41 ` Andi Kleen
2007-03-29 11:51 ` Kyle Moffett
2007-03-29 11:58 ` Andi Kleen
2007-03-28 11:06 ` [PATCH] Add support for deferrable timers (respun) Andi Kleen
2007-03-28 16:42 ` Venki Pallipadi
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=20070327223625.GA30923@linux-os.sc.intel.com \
--to=venkatesh.pallipadi@intel.com \
--cc=akpm@linux-foundation.org \
--cc=davej@codemonkey.org.uk \
--cc=johnstul@us.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=oleg@tv-sign.ru \
--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