public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Matthias-Christian Ott <matthias.christian@tiscali.de>
To: Chris Wedgwood <cw@f00f.org>
Cc: Steve Lord <lord@xfs.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: Preempt & Xfs Question
Date: Thu, 27 Jan 2005 18:24:13 +0000	[thread overview]
Message-ID: <41F931CD.5030401@tiscali.de> (raw)
In-Reply-To: <20050127155338.GB12493@taniwha.stupidest.org>

Chris Wedgwood wrote:

>On Thu, Jan 27, 2005 at 05:46:54PM +0000, Matthias-Christian Ott wrote:
>
>  
>
>>How did you fix it?
>>    
>>
>
>I suggested:
>
>===== fs/xfs/linux-2.6/xfs_stats.h 1.9 vs edited =====
>Index: cw-current/fs/xfs/linux-2.6/xfs_stats.h
>===================================================================
>--- cw-current.orig/fs/xfs/linux-2.6/xfs_stats.h	2005-01-17 16:03:59.656946818 -0800
>+++ cw-current/fs/xfs/linux-2.6/xfs_stats.h	2005-01-17 16:06:50.692361597 -0800
>@@ -142,9 +142,9 @@
> 
> /* 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))
>+#define XFS_STATS_INC(count)		(per_cpu(xfsstats, __smp_processor_id()).count++)
>+#define XFS_STATS_DEC(count)		(per_cpu(xfsstats, __smp_processor_id()).count--)
>+#define XFS_STATS_ADD(count, inc)	(per_cpu(xfsstats, __smp_processor_id()).count += (inc))
> 
> extern void xfs_init_procfs(void);
> extern void xfs_cleanup_procfs(void);
>
>but what was checked in was a bit cleaner.
>
>  
>
Well calling such a internal function (__function) is not a cleaning 
coding style but works best :-) .
Combined with the current_cpu() fixes I mentioned, it looks like this:

diff -Nru linux-2.6.11-rc2/fs/xfs/linux-2.6/xfs_linux.h 
linux-2.6.11-rc2-ott/fs/xfs/linux-2.6/xfs_linux.h
--- linux-2.6.11-rc2/fs/xfs/linux-2.6/xfs_linux.h    2004-12-24 
21:35:50.000000000 +0000
+++ linux-2.6.11-rc2-ott/fs/xfs/linux-2.6/xfs_linux.h    2005-01-27 
18:13:09.000000000 +0000
@@ -144,7 +144,7 @@
 #define xfs_inherit_nosymlinks    xfs_params.inherit_nosym.val
 #define xfs_rotorstep        xfs_params.rotorstep.val
 
-#define current_cpu()        smp_processor_id()
+#define current_cpu()        __smp_processor_id()
 #define current_pid()        (current->pid)
 #define current_fsuid(cred)    (current->fsuid)
 #define current_fsgid(cred)    (current->fsgid)
diff -Nru linux-2.6.11-rc2/fs/xfs/linux-2.6/xfs_stats.h 
linux-2.6.11-rc2-ott/fs/xfs/linux-2.6/xfs_stats.h
--- linux-2.6.11-rc2/fs/xfs/linux-2.6/xfs_stats.h    2004-12-24 
21:34:29.000000000 +0000
+++ linux-2.6.11-rc2-ott/fs/xfs/linux-2.6/xfs_stats.h    2005-01-27 
18:13:44.000000000 +0000
@@ -142,9 +142,9 @@
 
 /* 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))
+#define XFS_STATS_INC(count)        (per_cpu(xfsstats, 
__smp_processor_id()).count++)
+#define XFS_STATS_DEC(count)        (per_cpu(xfsstats, 
__smp_processor_id()).count--)
+#define XFS_STATS_ADD(count, inc)    (per_cpu(xfsstats, 
__smp_processor_id()).count += (inc))
 
 extern void xfs_init_procfs(void);
 extern void xfs_cleanup_procfs(void);

I'll submit it to the mailinglist as a seperate patch, so Linus can 
apply it to the current Kernel.

Matthias-Christian Ott

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


  reply	other threads:[~2005-01-27 16:24 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 [this message]
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

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=41F931CD.5030401@tiscali.de \
    --to=matthias.christian@tiscali.de \
    --cc=cw@f00f.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox