mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ming Lei <tom.leiming@gmail.com>
To: Arjan van de Ven <arjan@infradead.org>
Cc: linux-kernel@vger.kernel.org, akpm@linux-foundation.org
Subject: Re: [PATCH] kernel/async.c:introduce async_schedule*_atomic
Date: Mon, 18 May 2009 09:55:14 +0800	[thread overview]
Message-ID: <d82e647a0905171855x79850a5bv7262f9e698d8b3f7@mail.gmail.com> (raw)
In-Reply-To: <20090517132613.688da272@infradead.org>

2009/5/18 Arjan van de Ven <arjan@infradead.org>:
> On Tue, 12 May 2009 23:13:42 +0800
> tom.leiming@gmail.com wrote:
>
>> From: Ming Lei <tom.leiming@gmail.com>
>>
>> The async_schedule* may not be called in atomic contexts if out of
>> memory or if there's too much work pending already, because the
>> async function to be called may sleep.
>>
>> This patch fixes the comment of async_schedule*, and introduces
>> async_schedules*_atomic to allow them called from atomic contexts
>> safely.
>
> (sorry for the late response; have been away from most of my email for
> a few days)
>
> I like the general idea; I was hoping to do it a little bit different
> though, API wise.
> I don't mind the parameter for "don't do blocking things" (we should
> use that to also use GFP_KERNEL/GFP_NOFS or whatever for the
> allocation), it makes sense.
>
> What I would like to see is the option to pass in memory that was
> externally kmalloc'd. So that you can do
>
> foo = kmalloc(..)
> spin_lock(bar)
> ...
> async_schedule_atomic(...);
>
> spin_unlock(bar);
> if (not_used_foo)
>    kfree(foo);
>
> in cases where you don't want to fail while in the atomic portion,
> but can fail better earlier.

If we do this way, the type of async_schedule*()  and async_schedule*_inatomic()
is different, and callers will be messed with them, especially for _inatomic().

BTW: I have submited new version of this patches, would you mind
giving a review?

Thanks.

-- 
Lei Ming

  reply	other threads:[~2009-05-18  1:55 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-12 15:13 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
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 [this message]
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=d82e647a0905171855x79850a5bv7262f9e698d8b3f7@mail.gmail.com \
    --to=tom.leiming@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=arjan@infradead.org \
    --cc=linux-kernel@vger.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

all inboxes | Powered by JetHome®