mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Peter Xu <peterx@redhat.com>
To: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-kernel@vger.kernel.org,
	Marcelo Tosatti <mtosatti@redhat.com>,
	Luiz Capitulino <lcapitulino@redhat.com>
Subject: Re: [PATCH] timer: document TIMER_PINNED
Date: Thu, 27 Jun 2019 09:31:20 +0800	[thread overview]
Message-ID: <20190627013119.GA17087@xz-x1> (raw)
In-Reply-To: <alpine.DEB.2.21.1906270034520.32342@nanos.tec.linutronix.de>

On Thu, Jun 27, 2019 at 12:43:03AM +0200, Thomas Gleixner wrote:
> Peter,
> 
> On Tue, 18 Jun 2019, Peter Xu wrote:
> > -/*
> > - * A deferrable timer will work normally when the system is busy, but
> > - * will not cause a CPU to come out of idle just to service it; instead,
> > - * the timer will be serviced when the CPU eventually wakes up with a
> > - * subsequent non-deferrable timer.
> > +/**
> > + * @TIMER_DEFERRABLE: A deferrable timer will work normally when the
> > + * system is busy, but will not cause a CPU to come out of idle just
> > + * to service it; instead, the timer will be serviced when the CPU
> > + * eventually wakes up with a subsequent non-deferrable timer.
> >   *
> > - * An irqsafe timer is executed with IRQ disabled and it's safe to wait for
> > - * the completion of the running instance from IRQ handlers, for example,
> > - * by calling del_timer_sync().
> > + * @TIMER_IRQSAFE: An irqsafe timer is executed with IRQ disabled and
> > + * it's safe to wait for the completion of the running instance from
> > + * IRQ handlers, for example, by calling del_timer_sync().
> >   *
> >   * Note: The irq disabled callback execution is a special case for
> >   * workqueue locking issues. It's not meant for executing random crap
> >   * with interrupts disabled. Abuse is monitored!
> > + *
> > + * @TIMER_PINNED: A pinned timer will not be affected by timer
> > + * migration so it will always be run on a static cpu that was
> > + * specified.
> 
> That's a bit misleading.
> 
> The timer pinned flag prevents the MOHZ timer placement heuristics to take
> effect. That means that the timer is enqueued on the CPU on which the
> enqueue function is invoked. 

Right.  I thought these details could be hidden from the API layer so
timer users won't need to know these details (neither about NOHZ, nor
about the fact that the action of queuing the timer is the thing that
really matters, because add_timer_on() can hide all these), but it's
also ok to me if you prefer them to be exposed to the users.

> 
> > + * Note: neither timer_setup() nor mod_timer() will
> > + * guarantee correct pinning of timers.  One should always use
> > + * add_timer_on() when arm the timer to guarantee that the timer will
> > + * be pinned to the target CPU correctly.
> 
> I'd rather say:
> 
>     That means that pinned timers are not guaranteed to stay on the
>     initialy selected CPU. They move to the CPU on which the enqueue
>     function is invoked via mod_timer() or add_timer().
> 
>     If the timer should be placed on a particular CPU then add_timer_on()
>     has to be used.
> 
> Or something like that. Too tired to think about it right now, but you get
> the idea.

Yes, let me give it another shot soon...  Thanks,

-- 
Peter Xu

      reply	other threads:[~2019-06-27  1:33 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-18  0:43 Peter Xu
2019-06-26 22:43 ` Thomas Gleixner
2019-06-27  1:31   ` Peter Xu [this message]

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=20190627013119.GA17087@xz-x1 \
    --to=peterx@redhat.com \
    --cc=lcapitulino@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mtosatti@redhat.com \
    --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

all inboxes | Powered by JetHome®