All of lore.kernel.org
 help / color / mirror / Atom feed
From: Matthias-Christian Ott <matthias.christian@tiscali.de>
To: Steve Lord <lord@xfs.org>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: Preempt & Xfs Question
Date: Thu, 27 Jan 2005 17:41:48 +0000	[thread overview]
Message-ID: <41F927DC.50003@tiscali.de> (raw)
In-Reply-To: <41F908C4.4080608@xfs.org>

Steve Lord wrote:

> Matthias-Christian Ott wrote:
>
>> Hi!
>> I have a question: Why do I get such debug messages:
>>
>> BUG: using smp_processor_id() in preemptible [00000001] code: 
>> khelper/892
>> caller is _pagebuf_lookup_pages+0x11b/0x362
>> [<c03119c7>] smp_processor_id+0xa3/0xb4
>> [<c02ef802>] _pagebuf_lookup_pages+0x11b/0x362
>> [<c02ef802>] _pagebuf_lookup_pages+0x11b/0x362
>
>
> .....
>
>>
>> Does the XFS Module avoid preemption rules? If so, why?
>
>
> It is probably coming from these macros which keep various statistics
> inside xfs as per cpu variables.
>
> in fs//xfs/linux-2.6/xfs_stats.h:
>
> DECLARE_PER_CPU(struct xfsstats, xfsstats);
>
> /* We don't disable preempt, not too worried about poking the
>  * wrong cpu's stat for now */
> #define XFS_STATS_INC(count)            (__get_cpu_var(xfsstats).count++)
> #define XFS_STATS_DEC(count)            (__get_cpu_var(xfsstats).count--)
> #define XFS_STATS_ADD(count, inc)       (__get_cpu_var(xfsstats).count 
> += (inc))
>
> So it knows about the fact that preemption can mess up the result of 
> this,
> but it does not really matter for the purpose it is used for here. The
> stats are just informational but very handy for working out what is going
> on inside xfs. Using a global instead of a per cpu variable would
> lead to cache line contention.
>
> If you want to make it go away on a preemptable kernel, then use the
> alternate definition of the stat macros which is just below the
> above code.
>
> Steve
>
> p.s. try running xfs_stats.pl -f which comes with the xfs-cmds source to
> watch the stats.
>
>
Hi!
It happens to all functions -- not only to the stat functions -- because 
of this macro:
#define current_cpu()           smp_processor_id()

But this it not my problem (setting it 0 fixes it or get_cpu()). I just 
wanted to know why it breaks the preemption rules.

Matthias-Christian

-- 
http://unixforge.org/~matthias-christian-ott/


      parent reply	other threads:[~2005-01-27 15:42 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-01-27 16:18 Preempt & Xfs Question Matthias-Christian Ott
2005-01-27 15:29 ` Steve Lord
2005-01-27 15:40   ` Chris Wedgwood
2005-01-27 17:46     ` Matthias-Christian Ott
2005-01-27 15:53       ` Chris Wedgwood
2005-01-27 18:24         ` Matthias-Christian Ott
2005-01-27 16:51           ` Chris Wedgwood
2005-01-27 19:24             ` Matthias-Christian Ott
2005-01-27 21:11             ` Nathan Scott
2005-01-27 17:41   ` Matthias-Christian Ott [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=41F927DC.50003@tiscali.de \
    --to=matthias.christian@tiscali.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lord@xfs.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.