public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Frederic Weisbecker <fweisbec@gmail.com>
To: Ming Lei <tom.leiming@gmail.com>
Cc: Cornelia Huck <cornelia.huck@de.ibm.com>,
	arjan@infradead.org, linux-kernel@vger.kernel.org,
	akpm@linux-foundation.org
Subject: Re: [PATCH] kernel/async.c:introduce async_schedule*_atomic
Date: Wed, 13 May 2009 03:20:13 +0200	[thread overview]
Message-ID: <20090513012011.GA32518@nowhere> (raw)
In-Reply-To: <d82e647a0905121728m278b604bn9a0f5122b964978a@mail.gmail.com>

On Wed, May 13, 2009 at 08:28:15AM +0800, Ming Lei wrote:
> 2009/5/13 Cornelia Huck <cornelia.huck@de.ibm.com>:
> > On Tue, 12 May 2009 18:52:29 +0200,
> > Frederic Weisbecker <fweisbec@gmail.com> wrote:
> >
> >> This division would make more sense indeed.
> >>
> >> - async_schedule_inatomic() would be nosync() and would use
> >>   GFP_ATOMIC. I guess the case where we want to run
> >>   a job synchronously from atomic in case of async failure is too rare
> >>   (non-existent?).
> >
> > It would add complexity for those callers providing a function that is
> > safe to be called in both contexts.
> >
> >> - async_schedule_nosync() would be only nosync() and would use
> >>   GFP_KERNEL
> >>
> >> I'm not sure the second case will ever be used though.
> >
> > It might make sense for the "just fail if we cannot get memory" case.
> >
> >>
> >> Another alternative would be to define a single async_schedule_nosync()
> >> which also takes a gfp flag.
> >
> > Wouldn't async_schedule() then need a gfp flag as well?
> >
> 
> IMHO, we should call async_schedule*() from non-atomic contexts and
> async_schedule_inatomic*() from atomic contexts explicitly, so
> async_schedule*()
> use GFP_KERNEL and async_schedule_inatomic*() use GFP_ATOMIC
> always. This can simplify the problem much more.



I think Cornelia is right about the complex case of a job
launched from atomic context that could either be run
synchronously. I have troubles to imagine such case though
but I guess it's possible.

 
> Also we still allow async_schedule*()  to run a job synchronously if
> out of memory
> or other failure. This can keep consistency with before.


Yes, but also most of the current users of async_schedule() could call
it with GFP_KERNEL. For now it's not an issue because it is not widely
used, but who knows how that will evolve...


> Any sugesstions or objections?


I have shared feelings. I don't know if the dual sense of
this new helper deserves enough disambiguation and granularity
to be split up in two parts:

- adding an async_schedule_nosync() helper
- add a new gfpflag_t parameter


Or should we just do:

- adding async_schedule_inatomic() which is a merge of nosync + GFP_ATOMIC
- use GFP_KERNEL in async_schedule()


It depends on the future users. Will someone ever accept to schedule a job
that could end up running synchronously in the worst case?

Frederic.


  reply	other threads:[~2009-05-13  1:20 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-12 15:13 [PATCH] kernel/async.c:introduce async_schedule*_atomic tom.leiming
2009-05-12 15:44 ` Frederic Weisbecker
2009-05-12 15:58   ` Américo Wang
2009-05-13  0:36     ` Ming Lei
2009-05-12 16:04   ` Frederic Weisbecker
2009-05-12 16:31     ` Cornelia Huck
2009-05-12 16:52       ` Frederic Weisbecker
2009-05-12 17:18         ` Cornelia Huck
2009-05-13  0:28           ` Ming Lei
2009-05-13  1:20             ` Frederic Weisbecker [this message]
2009-05-13  7:47               ` Cornelia Huck
2009-05-17 20:59                 ` Arjan van de Ven
2009-05-18 11:29                   ` Cornelia Huck
2009-05-13  3:27           ` Ming Lei
2009-05-13  0:16     ` Ming Lei
2009-05-17 20:26 ` Arjan van de Ven
2009-05-18  1:55   ` Ming Lei
2009-05-18  4:18     ` Arjan van de Ven

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=20090513012011.GA32518@nowhere \
    --to=fweisbec@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=arjan@infradead.org \
    --cc=cornelia.huck@de.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tom.leiming@gmail.com \
    /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