linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Cc: xiaosuo@gmail.com, akpm@linux-foundation.org,
	eric.dumazet@gmail.com, jslaby@suse.cz, viro@zeniv.linux.org.uk,
	paulmck@linux.vnet.ibm.com, adobriyan@gmail.com, mingo@elte.hu,
	linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
	avi@redhat.com
Subject: Re: [RFC] mm: generic adaptive large memory allocation APIs
Date: Fri, 07 May 2010 14:52:54 +0200	[thread overview]
Message-ID: <1273236774.1642.353.camel@laptop> (raw)
In-Reply-To: <201005072142.IIC30776.FFtOOHMOVFJLQS@I-love.SAKURA.ne.jp>

On Fri, 2010-05-07 at 21:42 +0900, Tetsuo Handa wrote:
> Changli Gao wrote:
> > static void __kvfree(void *ptr, bool inatomic)
> 
> inatomic might be confusing because what vfree() checks is
> BUG_ON(in_interrupt()) rather than BUG_ON(in_atomic()).
> 
> > {
> >         if (unlikely(ZERO_OR_NULL_PTR(ptr)))
> >                 return;
> >         if (is_vmalloc_addr(ptr)) {
> >                 if (inatomic) {
> 
> By the way, is in_interrupt() a heavy operation?
> 
>   register unsigned long current_stack_pointer asm("esp") __used;
>   static inline struct thread_info *current_thread_info(void)
>   {
>   	return (struct thread_info *)
>   		(current_stack_pointer & ~(THREAD_SIZE - 1));
>   }
>   #define preempt_count() (current_thread_info()->preempt_count)
>   #define irq_count()     (preempt_count() & (HARDIRQ_MASK | SOFTIRQ_MASK | NMI_MASK))
>   #define in_interrupt()  (irq_count())
> 
> If we can agree on changing from (inatomic) to (in_interrupt()),
> we can merge kvfree() and kvfree_inatomic().

I really dislike all of that, just don't allow usage from interrupt
context.




  reply	other threads:[~2010-05-07 12:53 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-06  0:30 [RFC] mm: generic adaptive large memory allocation APIs Changli Gao
2010-05-06  0:37 ` Changli Gao
2010-05-06  1:25 ` Changli Gao
2010-05-06  3:12 ` Tetsuo Handa
2010-05-06  3:22   ` Changli Gao
2010-05-06 15:35 ` Jamie Lokier
2010-05-07  4:32 ` Changli Gao
2010-05-07 12:42   ` Tetsuo Handa
2010-05-07 12:52     ` Peter Zijlstra [this message]
2010-05-13  4:45 ` KOSAKI Motohiro
2010-05-13  8:43   ` Jiri Slaby
2010-05-13  9:05     ` KOSAKI Motohiro
2010-05-13  9:19       ` Jiri Slaby
2010-05-13  9:40         ` KOSAKI Motohiro
2010-05-13 10:16           ` Jiri Slaby
2010-05-13 10:43             ` KOSAKI Motohiro

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=1273236774.1642.353.camel@laptop \
    --to=peterz@infradead.org \
    --cc=adobriyan@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=avi@redhat.com \
    --cc=eric.dumazet@gmail.com \
    --cc=jslaby@suse.cz \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=paulmck@linux.vnet.ibm.com \
    --cc=penguin-kernel@I-love.SAKURA.ne.jp \
    --cc=viro@zeniv.linux.org.uk \
    --cc=xiaosuo@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;
as well as URLs for NNTP newsgroup(s).