Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1238442 > unrolled thread

[PATCH] percpu_counter: return precise count from __percpu_counter_compare()

Started byWaiman Long <Waiman.Long@hpe.com>
First post2015-10-02 19:40 +0200
Last post2015-10-03 00:20 +0200
Articles 5 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] percpu_counter: return precise count from __percpu_counter_compare() Waiman Long <Waiman.Long@hpe.com> - 2015-10-02 19:40 +0200
    Re: [PATCH] percpu_counter: return precise count from  __percpu_counter_compare() kbuild test robot <lkp@intel.com> - 2015-10-02 20:10 +0200
    Re: [PATCH] percpu_counter: return precise count from  __percpu_counter_compare() kbuild test robot <lkp@intel.com> - 2015-10-02 20:10 +0200
    Re: [PATCH] percpu_counter: return precise count from  __percpu_counter_compare() kbuild test robot <lkp@intel.com> - 2015-10-02 20:20 +0200
    Re: [PATCH] percpu_counter: return precise count from  __percpu_counter_compare() Dave Chinner <david@fromorbit.com> - 2015-10-03 00:20 +0200

#1238442 — [PATCH] percpu_counter: return precise count from __percpu_counter_compare()

FromWaiman Long <Waiman.Long@hpe.com>
Date2015-10-02 19:40 +0200
Subject[PATCH] percpu_counter: return precise count from __percpu_counter_compare()
Message-ID<qfctj-1MB-7@gated-at.bofh.it>
In __percpu_counter_compare(), if the current imprecise count is
within (batch*nr_cpus) of the input value to be compared, a call
to percpu_counter_sum() will be made to get the precise count. The
percpu_counter_sum() call, however, can be expensive especially on
large systems where there are a lot of CPUs. Large systems also make
it more likely that percpu_counter_sum() will be called.

The xfs_mod_fdblocks() function calls __percpu_counter_compare()
twice. First to see if a smaller batch size should be used for
__percpu_counter_add() and the second call to compare the actual
size needed. This can potentially lead to 2 calls to the expensive
percpu_counter_sum() function.

This patch added an extra argument to __percpu_counter_compare()
to return the precise count, if computed. The caller will need to
initialize it to an invalid value that it can tell if the precise
count is being returned.

The xfs_mod_fdblocks() function was then modified to use the
precise count for comparison, if returned. Otherwise, it will call
__percpu_counter_compare() the second time.

Running the AIM7 disk workload with XFS filesystem, the jobs/min
on a 40-core 80-thread 4-socket Haswell-EX system increases from
3805k to 4276k (12% increase) with this patch applied. As measured
by the perf tool, the %CPU cycle consumed by __percpu_counter_sum()
decreases from 12.64% to 7.08%.

Signed-off-by: Waiman Long <Waiman.Long@hpe.com>
---
 fs/xfs/xfs_mount.c             |   17 +++++++++++++----
 include/linux/percpu_counter.h |    9 +++++----
 lib/percpu_counter.c           |   11 ++++++++++-
 3 files changed, 28 insertions(+), 9 deletions(-)

diff --git a/fs/xfs/xfs_mount.c b/fs/xfs/xfs_mount.c
index bf92e0c..8586b62 100644
--- a/fs/xfs/xfs_mount.c
+++ b/fs/xfs/xfs_mount.c
@@ -1115,7 +1115,7 @@ xfs_mod_icount(
 	int64_t			delta)
 {
 	__percpu_counter_add(&mp->m_icount, delta, XFS_ICOUNT_BATCH);
-	if (__percpu_counter_compare(&mp->m_icount, 0, XFS_ICOUNT_BATCH) < 0) {
+	if (__percpu_counter_compare(&mp->m_icount, 0, XFS_ICOUNT_BATCH, NULL) < 0) {
 		ASSERT(0);
 		percpu_counter_add(&mp->m_icount, -delta);
 		return -EINVAL;
@@ -1154,6 +1154,7 @@ xfs_mod_fdblocks(
 	int64_t			lcounter;
 	long long		res_used;
 	s32			batch;
+	s64			pcount;	/* Precise count */
 
 	if (delta > 0) {
 		/*
@@ -1187,15 +1188,23 @@ xfs_mod_fdblocks(
 	 * then make everything serialise as we are real close to
 	 * ENOSPC.
 	 */
+	pcount = -1;
 	if (__percpu_counter_compare(&mp->m_fdblocks, 2 * XFS_FDBLOCKS_BATCH,
-				     XFS_FDBLOCKS_BATCH) < 0)
+				     XFS_FDBLOCKS_BATCH, &pcount) < 0)
 		batch = 1;
 	else
 		batch = XFS_FDBLOCKS_BATCH;
 
 	__percpu_counter_add(&mp->m_fdblocks, delta, batch);
-	if (__percpu_counter_compare(&mp->m_fdblocks, XFS_ALLOC_SET_ASIDE(mp),
-				     XFS_FDBLOCKS_BATCH) >= 0) {
+	if (pcount >= 0) {
+		/*
+		 * No need to call __percpu_counter_compare() again if the
+		 * precise count has been computed.
+		 */
+		if (pcount + delta >= XFS_ALLOC_SET_ASIDE(mp))
+			return 0;	/* we have space */
+	} else if (__percpu_counter_compare(&mp->m_fdblocks,
+		   XFS_ALLOC_SET_ASIDE(mp), XFS_FDBLOCKS_BATCH, NULL) >= 0) {
 		/* we had space! */
 		return 0;
 	}
diff --git a/include/linux/percpu_counter.h b/include/linux/percpu_counter.h
index 84a1094..4690143 100644
--- a/include/linux/percpu_counter.h
+++ b/include/linux/percpu_counter.h
@@ -41,11 +41,12 @@ void percpu_counter_destroy(struct percpu_counter *fbc);
 void percpu_counter_set(struct percpu_counter *fbc, s64 amount);
 void __percpu_counter_add(struct percpu_counter *fbc, s64 amount, s32 batch);
 s64 __percpu_counter_sum(struct percpu_counter *fbc);
-int __percpu_counter_compare(struct percpu_counter *fbc, s64 rhs, s32 batch);
+int __percpu_counter_compare(struct percpu_counter *fbc, s64 rhs, s32 batch,
+			     s64 *pcnt);
 
 static inline int percpu_counter_compare(struct percpu_counter *fbc, s64 rhs)
 {
-	return __percpu_counter_compare(fbc, rhs, percpu_counter_batch);
+	return __percpu_counter_compare(fbc, rhs, percpu_counter_batch, NULL);
 }
 
 static inline void percpu_counter_add(struct percpu_counter *fbc, s64 amount)
@@ -121,8 +122,8 @@ static inline int percpu_counter_compare(struct percpu_counter *fbc, s64 rhs)
 		return 0;
 }
 
-static inline int
-__percpu_counter_compare(struct percpu_counter *fbc, s64 rhs, s32 batch)
+static inline int __percpu_counter_compare(struct percpu_counter *fbc, s64 rhs,
+					   s32 batch, s64 *pcnt))
 {
 	return percpu_counter_compare(fbc, rhs);
 }
diff --git a/lib/percpu_counter.c b/lib/percpu_counter.c
index f051d69..37e253c 100644
--- a/lib/percpu_counter.c
+++ b/lib/percpu_counter.c
@@ -196,8 +196,14 @@ static int percpu_counter_hotcpu_callback(struct notifier_block *nb,
 /*
  * Compare counter against given value.
  * Return 1 if greater, 0 if equal and -1 if less
+ *
+ * The precise count, if computed, will be returned in the location pointed
+ * to by pcnt. The *pcnt value should be properly initialized before calling
+ * this function so that the caller can easily distinguish if the count has
+ * been returned.
  */
-int __percpu_counter_compare(struct percpu_counter *fbc, s64 rhs, s32 batch)
+int __percpu_counter_compare(struct percpu_counter *fbc, s64 rhs, s32 batch,
+			     s64 *pcnt)
 {
 	s64	count;
 
@@ -211,6 +217,9 @@ int __percpu_counter_compare(struct percpu_counter *fbc, s64 rhs, s32 batch)
 	}
 	/* Need to use precise count */
 	count = percpu_counter_sum(fbc);
+
+	if (pcnt)
+		*pcnt = count;	/* Store the precise count */
 	if (count > rhs)
 		return 1;
 	else if (count < rhs)
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1238492 — Re: [PATCH] percpu_counter: return precise count from __percpu_counter_compare()

Fromkbuild test robot <lkp@intel.com>
Date2015-10-02 20:10 +0200
SubjectRe: [PATCH] percpu_counter: return precise count from __percpu_counter_compare()
Message-ID<qfcWn-2zG-11@gated-at.bofh.it>
In reply to#1238442

[Multipart message — attachments visible in raw view] — view raw

Hi Waiman,

[auto build test results on v4.3-rc3 -- if it's inappropriate base, please ignore]

config: i386-alldefconfig (attached as .config)
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

All error/warnings (new ones prefixed by >>):

   In file included from include/linux/proportions.h:12:0,
                    from include/linux/sched.h:43,
                    from include/linux/uaccess.h:4,
                    from include/linux/crypto.h:26,
                    from arch/x86/kernel/asm-offsets.c:8:
   include/linux/percpu_counter.h: In function '__percpu_counter_compare':
   include/linux/percpu_counter.h:126:30: error: expected declaration specifiers before ')' token
            s32 batch, s64 *pcnt))
                                 ^
   include/linux/percpu_counter.h:133:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    {
    ^
   include/linux/percpu_counter.h:141:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    {
    ^
   include/linux/percpu_counter.h:146:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    {
    ^
   include/linux/percpu_counter.h:155:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    {
    ^
   include/linux/percpu_counter.h:160:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    {
    ^
   include/linux/percpu_counter.h:165:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    {
    ^
   include/linux/percpu_counter.h:170:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    {
    ^
   include/linux/percpu_counter.h:177:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    {
    ^
   include/linux/percpu_counter.h:182:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    {
    ^
   include/linux/percpu_counter.h:187:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    {
    ^
   In file included from include/linux/sched.h:43:0,
                    from include/linux/uaccess.h:4,
                    from include/linux/crypto.h:26,
                    from arch/x86/kernel/asm-offsets.c:8:
   include/linux/proportions.h:17:1: warning: empty declaration
    struct prop_global {
    ^
   include/linux/proportions.h:38:1: warning: empty declaration
    struct prop_descriptor {
    ^
   include/linux/proportions.h:51:1: warning: empty declaration
    struct prop_local_percpu {
    ^
   include/linux/proportions.h:73:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    {
    ^
   include/linux/proportions.h:102:1: warning: empty declaration
    struct prop_local_single {
    ^
   include/linux/proportions.h:129:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    {
    ^
   In file included from include/linux/seccomp.h:4:0,
                    from include/linux/sched.h:44,
                    from include/linux/uaccess.h:4,
                    from include/linux/crypto.h:26,
                    from arch/x86/kernel/asm-offsets.c:8:
   include/uapi/linux/seccomp.h:47:1: warning: empty declaration
    struct seccomp_data {
    ^
   In file included from include/linux/sched.h:44:0,
                    from include/linux/uaccess.h:4,
                    from include/linux/crypto.h:26,
                    from arch/x86/kernel/asm-offsets.c:8:
   include/linux/seccomp.h:13:1: warning: empty declaration
    struct seccomp_filter;
    ^
   include/linux/seccomp.h:25:1: warning: empty declaration
    struct seccomp {
    ^
>> include/linux/seccomp.h:31:12: error: storage class specified for parameter '__secure_computing'
    extern int __secure_computing(void);
               ^
   include/linux/seccomp.h:33:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    {
    ^
>> include/linux/seccomp.h:42:12: error: storage class specified for parameter 'seccomp_phase1'
    extern u32 seccomp_phase1(struct seccomp_data *sd);
               ^
>> include/linux/seccomp.h:48:13: error: storage class specified for parameter 'prctl_get_seccomp'
    extern long prctl_get_seccomp(void);
                ^
>> include/linux/seccomp.h:49:13: error: storage class specified for parameter 'prctl_set_seccomp'
    extern long prctl_set_seccomp(unsigned long, char __user *);
                ^
   include/linux/seccomp.h:52:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    {
    ^
   include/linux/seccomp.h:90:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    {
    ^
   include/linux/seccomp.h:94:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    {
    ^
   In file included from include/linux/sched.h:46:0,
                    from include/linux/uaccess.h:4,
                    from include/linux/crypto.h:26,
                    from arch/x86/kernel/asm-offsets.c:8:
   include/linux/rculist.h:31:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    {
    ^
   include/linux/rculist.h:51:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    {
    ^
   include/linux/rculist.h:79:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    {
    ^
   include/linux/rculist.h:101:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    {
    ^
   include/linux/rculist.h:130:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    {
    ^
   include/linux/rculist.h:156:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    {
    ^
   include/linux/rculist.h:173:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    {
    ^
   include/linux/rculist.h:201:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    {
    ^
   include/linux/rculist.h:344:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    {
    ^
   include/linux/rculist.h:358:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    {
    ^
   include/linux/rculist.h:397:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    {
    ^
   include/linux/rculist.h:427:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    {
    ^
   include/linux/rculist.h:454:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    {
    ^
   In file included from include/linux/sched.h:47:0,
                    from include/linux/uaccess.h:4,
                    from include/linux/crypto.h:26,
                    from arch/x86/kernel/asm-offsets.c:8:
   include/linux/rtmutex.h:19:12: error: storage class specified for parameter 'max_lock_depth'
    extern int max_lock_depth; /* for sysctl */
               ^
   include/linux/rtmutex.h:29:1: warning: empty declaration
    struct rt_mutex {
    ^
   include/linux/rtmutex.h:42:1: warning: empty declaration
    struct rt_mutex_waiter;
    ^
   include/linux/rtmutex.h:43:1: warning: empty declaration
    struct hrtimer_sleeper;
    ^
   include/linux/rtmutex.h:52:2: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
     {
     ^
   include/linux/rtmutex.h:85:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    {
    ^
   include/linux/rtmutex.h:89:13: error: storage class specified for parameter '__rt_mutex_init'
    extern void __rt_mutex_init(struct rt_mutex *lock, const char *name);
                ^
   include/linux/rtmutex.h:90:13: error: storage class specified for parameter 'rt_mutex_destroy'
    extern void rt_mutex_destroy(struct rt_mutex *lock);
                ^
   include/linux/rtmutex.h:92:13: error: storage class specified for parameter 'rt_mutex_lock'
    extern void rt_mutex_lock(struct rt_mutex *lock);
                ^
   include/linux/rtmutex.h:93:12: error: storage class specified for parameter 'rt_mutex_lock_interruptible'
    extern int rt_mutex_lock_interruptible(struct rt_mutex *lock);
               ^
   include/linux/rtmutex.h:94:12: error: storage class specified for parameter 'rt_mutex_timed_lock'
    extern int rt_mutex_timed_lock(struct rt_mutex *lock,
               ^
   include/linux/rtmutex.h:97:12: error: storage class specified for parameter 'rt_mutex_trylock'
    extern int rt_mutex_trylock(struct rt_mutex *lock);
               ^
   include/linux/rtmutex.h:99:13: error: storage class specified for parameter 'rt_mutex_unlock'
    extern void rt_mutex_unlock(struct rt_mutex *lock);
                ^
   In file included from include/linux/resource.h:4:0,
                    from include/linux/sched.h:51,
                    from include/linux/uaccess.h:4,

vim +/__secure_computing +31 include/linux/seccomp.h

c2e1f2e30 Kees Cook        2014-06-05   7  
^1da177e4 Linus Torvalds   2005-04-16   8  #ifdef CONFIG_SECCOMP
^1da177e4 Linus Torvalds   2005-04-16   9  
^1da177e4 Linus Torvalds   2005-04-16  10  #include <linux/thread_info.h>
^1da177e4 Linus Torvalds   2005-04-16  11  #include <asm/seccomp.h>
^1da177e4 Linus Torvalds   2005-04-16  12  
e2cfabdfd Will Drewry      2012-04-12 @13  struct seccomp_filter;
e2cfabdfd Will Drewry      2012-04-12  14  /**
e2cfabdfd Will Drewry      2012-04-12  15   * struct seccomp - the state of a seccomp'ed process
e2cfabdfd Will Drewry      2012-04-12  16   *
e2cfabdfd Will Drewry      2012-04-12  17   * @mode:  indicates one of the valid values above for controlled
e2cfabdfd Will Drewry      2012-04-12  18   *         system calls available to a process.
dbd952127 Kees Cook        2014-06-27  19   * @filter: must always point to a valid seccomp-filter or NULL as it is
dbd952127 Kees Cook        2014-06-27  20   *          accessed without locking during system call entry.
e2cfabdfd Will Drewry      2012-04-12  21   *
e2cfabdfd Will Drewry      2012-04-12  22   *          @filter must only be accessed from the context of current as there
dbd952127 Kees Cook        2014-06-27  23   *          is no read locking.
e2cfabdfd Will Drewry      2012-04-12  24   */
932ecebb0 Will Drewry      2012-04-12 @25  struct seccomp {
932ecebb0 Will Drewry      2012-04-12  26  	int mode;
e2cfabdfd Will Drewry      2012-04-12  27  	struct seccomp_filter *filter;
932ecebb0 Will Drewry      2012-04-12  28  };
^1da177e4 Linus Torvalds   2005-04-16  29  
a4412fc94 Andy Lutomirski  2014-07-21  30  #ifdef CONFIG_HAVE_ARCH_SECCOMP_FILTER
a4412fc94 Andy Lutomirski  2014-07-21 @31  extern int __secure_computing(void);
a4412fc94 Andy Lutomirski  2014-07-21  32  static inline int secure_computing(void)
^1da177e4 Linus Torvalds   2005-04-16 @33  {
^1da177e4 Linus Torvalds   2005-04-16  34  	if (unlikely(test_thread_flag(TIF_SECCOMP)))
a4412fc94 Andy Lutomirski  2014-07-21  35  		return  __secure_computing();
acf3b2c71 Will Drewry      2012-04-12  36  	return 0;
^1da177e4 Linus Torvalds   2005-04-16  37  }
13aa72f0f Andy Lutomirski  2014-07-21  38  
13aa72f0f Andy Lutomirski  2014-07-21  39  #define SECCOMP_PHASE1_OK	0
13aa72f0f Andy Lutomirski  2014-07-21  40  #define SECCOMP_PHASE1_SKIP	1
13aa72f0f Andy Lutomirski  2014-07-21  41  
d39bd00de Andy Lutomirski  2014-07-21 @42  extern u32 seccomp_phase1(struct seccomp_data *sd);
13aa72f0f Andy Lutomirski  2014-07-21  43  int seccomp_phase2(u32 phase1_result);
a4412fc94 Andy Lutomirski  2014-07-21  44  #else
a4412fc94 Andy Lutomirski  2014-07-21  45  extern void secure_computing_strict(int this_syscall);
a4412fc94 Andy Lutomirski  2014-07-21  46  #endif
e4da89d02 Will Drewry      2012-04-17  47  
1d9d02fee Andrea Arcangeli 2007-07-15 @48  extern long prctl_get_seccomp(void);
e2cfabdfd Will Drewry      2012-04-12 @49  extern long prctl_set_seccomp(unsigned long, char __user *);
1d9d02fee Andrea Arcangeli 2007-07-15  50  
932ecebb0 Will Drewry      2012-04-12  51  static inline int seccomp_mode(struct seccomp *s)
5cec93c21 Andy Lutomirski  2011-06-05  52  {

:::::: The code at line 31 was first introduced by commit
:::::: a4412fc9486ec85686c6c7929e7e829f62ae377e seccomp,x86,arm,mips,s390: Remove nr parameter from secure_computing

:::::: TO: Andy Lutomirski <luto@amacapital.net>
:::::: CC: Kees Cook <keescook@chromium.org>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[toc] | [prev] | [next] | [standalone]


#1238494 — Re: [PATCH] percpu_counter: return precise count from __percpu_counter_compare()

Fromkbuild test robot <lkp@intel.com>
Date2015-10-02 20:10 +0200
SubjectRe: [PATCH] percpu_counter: return precise count from __percpu_counter_compare()
Message-ID<qfcWn-2zG-19@gated-at.bofh.it>
In reply to#1238442

[Multipart message — attachments visible in raw view] — view raw

Hi Waiman,

[auto build test results on v4.3-rc3 -- if it's inappropriate base, please ignore]

config: ia64-allnoconfig (attached as .config)
reproduce:
        wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=ia64 

All error/warnings (new ones prefixed by >>):

   include/linux/sched.h:326:19: error: storage class specified for parameter 'mmlist_lock'
    extern spinlock_t mmlist_lock;
                      ^
   include/linux/sched.h:328:1: warning: empty declaration
    struct task_struct;
    ^
   include/linux/sched.h:334:13: error: storage class specified for parameter 'sched_init'
    extern void sched_init(void);
                ^
   include/linux/sched.h:335:13: error: storage class specified for parameter 'sched_init_smp'
    extern void sched_init_smp(void);
                ^
   include/linux/sched.h:336:24: error: storage class specified for parameter 'schedule_tail'
    extern asmlinkage void schedule_tail(struct task_struct *prev);
                           ^
   include/linux/sched.h:337:13: error: storage class specified for parameter 'init_idle'
    extern void init_idle(struct task_struct *idle, int cpu);
                ^
   include/linux/sched.h:338:13: error: storage class specified for parameter 'init_idle_bootup_task'
    extern void init_idle_bootup_task(struct task_struct *idle);
                ^
   include/linux/sched.h:340:22: error: storage class specified for parameter 'cpu_isolated_map'
    extern cpumask_var_t cpu_isolated_map;
                         ^
   include/linux/sched.h:342:12: error: storage class specified for parameter 'runqueue_is_locked'
    extern int runqueue_is_locked(int cpu);
               ^
   include/linux/sched.h:349:53: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    static inline void nohz_balance_enter_idle(int cpu) { }
                                                        ^
   include/linux/sched.h:350:48: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    static inline void set_cpu_sd_state_idle(void) { }
                                                   ^
   include/linux/sched.h:356:13: error: storage class specified for parameter 'show_state_filter'
    extern void show_state_filter(unsigned long state_filter);
                ^
   include/linux/sched.h:359:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    {
    ^
   include/linux/sched.h:363:13: error: storage class specified for parameter 'show_regs'
    extern void show_regs(struct pt_regs *);
                ^
   include/linux/sched.h:370:13: error: storage class specified for parameter 'show_stack'
    extern void show_stack(struct task_struct *task, unsigned long *sp);
                ^
   include/linux/sched.h:372:13: error: storage class specified for parameter 'cpu_init'
    extern void cpu_init (void);
                ^
   include/linux/sched.h:373:13: error: storage class specified for parameter 'trap_init'
    extern void trap_init(void);
                ^
   include/linux/sched.h:374:13: error: storage class specified for parameter 'update_process_times'
    extern void update_process_times(int user);
                ^
   include/linux/sched.h:375:13: error: storage class specified for parameter 'scheduler_tick'
    extern void scheduler_tick(void);
                ^
   include/linux/sched.h:377:13: error: storage class specified for parameter 'sched_show_task'
    extern void sched_show_task(struct task_struct *p);
                ^
   include/linux/sched.h:390:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    {
    ^
   include/linux/sched.h:393:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    {
    ^
   include/linux/sched.h:396:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    {
    ^
   include/linux/sched.h:399:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    {
    ^
   include/linux/sched.h:407:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    {
    ^
   include/linux/sched.h:415:13: error: storage class specified for parameter '__sched_text_start'
    extern char __sched_text_start[], __sched_text_end[];
                ^
   include/linux/sched.h:415:35: error: storage class specified for parameter '__sched_text_end'
    extern char __sched_text_start[], __sched_text_end[];
                                      ^
   include/linux/sched.h:418:12: error: storage class specified for parameter 'in_sched_functions'
    extern int in_sched_functions(unsigned long addr);
               ^
   include/linux/sched.h:421:20: error: storage class specified for parameter 'schedule_timeout'
    extern signed long schedule_timeout(signed long timeout);
                       ^
   include/linux/sched.h:422:20: error: storage class specified for parameter 'schedule_timeout_interruptible'
    extern signed long schedule_timeout_interruptible(signed long timeout);
                       ^
   include/linux/sched.h:423:20: error: storage class specified for parameter 'schedule_timeout_killable'
    extern signed long schedule_timeout_killable(signed long timeout);
                       ^
   include/linux/sched.h:424:20: error: storage class specified for parameter 'schedule_timeout_uninterruptible'
    extern signed long schedule_timeout_uninterruptible(signed long timeout);
                       ^
   In file included from include/linux/linkage.h:7:0,
                    from include/linux/kernel.h:6,
                    from include/linux/sched.h:17,
                    from arch/ia64/kernel/asm-offsets.c:9:
>> arch/ia64/include/asm/linkage.h:6:35: error: expected declaration specifiers before '__attribute__'
    #define asmlinkage CPP_ASMLINKAGE __attribute__((syscall_linkage))
                                      ^
>> include/linux/sched.h:425:1: note: in expansion of macro 'asmlinkage'
    asmlinkage void schedule(void);
    ^
   In file included from arch/ia64/kernel/asm-offsets.c:9:0:
   include/linux/sched.h:426:13: error: storage class specified for parameter 'schedule_preempt_disabled'
    extern void schedule_preempt_disabled(void);
                ^
   include/linux/sched.h:428:13: error: storage class specified for parameter 'io_schedule_timeout'
    extern long io_schedule_timeout(long timeout);
                ^
   include/linux/sched.h:431:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    {
    ^
   include/linux/sched.h:435:1: warning: empty declaration
    struct nsproxy;
    ^
   include/linux/sched.h:436:1: warning: empty declaration
    struct user_namespace;
    ^
   include/linux/sched.h:439:13: error: storage class specified for parameter 'arch_pick_mmap_layout'
    extern void arch_pick_mmap_layout(struct mm_struct *mm);
                ^
   include/linux/sched.h:441:1: error: storage class specified for parameter 'arch_get_unmapped_area'
    arch_get_unmapped_area(struct file *, unsigned long, unsigned long,
    ^
   include/linux/sched.h:444:1: error: storage class specified for parameter 'arch_get_unmapped_area_topdown'
    arch_get_unmapped_area_topdown(struct file *filp, unsigned long addr,
    ^
   include/linux/sched.h:461:13: error: storage class specified for parameter 'set_dumpable'
    extern void set_dumpable(struct mm_struct *mm, int value);
                ^
   include/linux/sched.h:469:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    {
    ^
   include/linux/sched.h:474:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    {
    ^
   include/linux/sched.h:510:1: warning: empty declaration
    struct sighand_struct {
    ^
   include/linux/sched.h:517:1: warning: empty declaration
    struct pacct_struct {
    ^
   include/linux/sched.h:525:1: warning: empty declaration
    struct cpu_itimer {
    ^
   include/linux/sched.h:541:1: warning: empty declaration
    struct prev_cputime {
    ^
   include/linux/sched.h:550:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    {
    ^
   include/linux/sched.h:567:1: warning: empty declaration
    struct task_cputime {
    ^
   include/linux/sched.h:589:1: warning: empty declaration
    struct task_cputime_atomic {
    ^
   include/linux/sched.h:626:1: warning: empty declaration
    struct thread_group_cputimer {
    ^
   include/linux/sched.h:632:1: warning: empty declaration
    struct autogroup;
    ^
   include/linux/sched.h:641:1: warning: empty declaration
    struct signal_struct {
    ^
   include/linux/sched.h:806:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    {
    ^
   include/linux/sched.h:814:1: warning: empty declaration
    struct user_struct {
    ^
   include/linux/sched.h:848:12: error: storage class specified for parameter 'uids_sysfs_init'
    extern int uids_sysfs_init(void);
               ^
   include/linux/sched.h:850:28: error: storage class specified for parameter 'find_user'
    extern struct user_struct *find_user(kuid_t);
                               ^
   include/linux/sched.h:852:27: error: storage class specified for parameter 'root_user'
    extern struct user_struct root_user;
                              ^
   include/linux/sched.h:856:1: warning: empty declaration
    struct backing_dev_info;
    ^
   include/linux/sched.h:857:1: warning: empty declaration
    struct reclaim_state;
    ^
   include/linux/sched.h:906:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    {
    ^
   include/linux/sched.h:917:1: warning: empty declaration
    enum cpu_idle_type {
    ^
   include/linux/sched.h:956:1: warning: empty declaration
    struct wake_q_node {
    ^
   include/linux/sched.h:960:1: warning: empty declaration
    struct wake_q_head {
    ^
   include/linux/sched.h:970:13: error: storage class specified for parameter 'wake_q_add'
    extern void wake_q_add(struct wake_q_head *head,
                ^
   include/linux/sched.h:972:13: error: storage class specified for parameter 'wake_up_q'
    extern void wake_up_q(struct wake_q_head *head);
                ^
   include/linux/sched.h:1155:1: warning: empty declaration
    struct sched_domain_attr;
    ^
   include/linux/sched.h:1160:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    {
    ^
   include/linux/sched.h:1164:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    {
    ^
   include/linux/sched.h:1171:1: warning: empty declaration
    struct io_context;   /* See blkdev.h */
    ^
>> include/linux/sched.h:1175:13: error: storage class specified for parameter 'prefetch_stack'
    extern void prefetch_stack(struct task_struct *t);
                ^
   include/linux/sched.h:1180:1: warning: empty declaration
    struct audit_context;  /* See audit.c */
    ^
   include/linux/sched.h:1181:1: warning: empty declaration
    struct mempolicy;
    ^
   include/linux/sched.h:1182:1: warning: empty declaration
    struct pipe_inode_info;
    ^
   include/linux/sched.h:1183:1: warning: empty declaration
    struct uts_namespace;
    ^
   include/linux/sched.h:1185:1: warning: empty declaration
    struct load_weight {
    ^
   include/linux/sched.h:1204:1: warning: empty declaration
    struct sched_avg {
    ^
   include/linux/sched.h:1246:1: warning: empty declaration
    struct sched_entity {
    ^
   include/linux/sched.h:1278:1: warning: empty declaration
    struct sched_rt_entity {
    ^
   include/linux/sched.h:1294:1: warning: empty declaration
    struct sched_dl_entity {
    ^
   include/linux/sched.h:1343:1: warning: empty declaration
    union rcu_special {
    ^
   include/linux/sched.h:1350:1: warning: empty declaration
    struct rcu_node;
    ^
   include/linux/sched.h:1352:1: warning: empty declaration
    enum perf_event_task_context {
    ^
   include/linux/sched.h:1360:1: warning: empty declaration
    struct tlbflush_unmap_batch {
    ^
   include/linux/sched.h:1378:1: warning: empty declaration
    struct task_struct {
    ^
   include/linux/sched.h:1850:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    {
    ^
   include/linux/sched.h:1853:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    {
    ^
   include/linux/sched.h:1857:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    {
    ^
   include/linux/sched.h:1860:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    {
    ^
   include/linux/sched.h:1864:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    {
    ^
   include/linux/sched.h:1870:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    {
    ^
   include/linux/sched.h:1875:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    {
    ^
   include/linux/sched.h:1885:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    {
    ^
   include/linux/sched.h:1890:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    {
    ^
   include/linux/sched.h:1894:1: warning: empty declaration
    struct pid_namespace;
    ^
   include/linux/sched.h:1913:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    {
    ^
   include/linux/sched.h:1919:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    {
    ^
   include/linux/sched.h:1924:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    {
    ^
   include/linux/sched.h:1930:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    {
    ^
   include/linux/sched.h:1937:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    {
    ^
   include/linux/sched.h:1942:19: error: storage class specified for parameter 'pid_alive'
    static inline int pid_alive(const struct task_struct *p);
                      ^
   include/linux/sched.h:1942:19: warning: parameter 'pid_alive' declared 'inline'
   include/linux/sched.h:1942:42: warning: 'always_inline' attribute ignored [-Wattributes]
    static inline int pid_alive(const struct task_struct *p);
                                             ^
   include/linux/sched.h:1942:19: error: 'no_instrument_function' attribute applies only to functions
    static inline int pid_alive(const struct task_struct *p);
                      ^
   include/linux/sched.h:1944:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
..

vim +/__attribute__ +6 arch/ia64/include/asm/linkage.h

^1da177e include/asm-ia64/linkage.h      Linus Torvalds 2005-04-16   1  #ifndef __ASM_LINKAGE_H
^1da177e include/asm-ia64/linkage.h      Linus Torvalds 2005-04-16   2  #define __ASM_LINKAGE_H
^1da177e include/asm-ia64/linkage.h      Linus Torvalds 2005-04-16   3  
ab7efcc9 include/asm-ia64/linkage.h      Jan Beulich    2006-03-24   4  #ifndef __ASSEMBLY__
ab7efcc9 include/asm-ia64/linkage.h      Jan Beulich    2006-03-24   5  
^1da177e include/asm-ia64/linkage.h      Linus Torvalds 2005-04-16  @6  #define asmlinkage CPP_ASMLINKAGE __attribute__((syscall_linkage))
^1da177e include/asm-ia64/linkage.h      Linus Torvalds 2005-04-16   7  
ab7efcc9 include/asm-ia64/linkage.h      Jan Beulich    2006-03-24   8  #else
ab7efcc9 include/asm-ia64/linkage.h      Jan Beulich    2006-03-24   9  
ab7efcc9 include/asm-ia64/linkage.h      Jan Beulich    2006-03-24  10  #include <asm/asmmacro.h>
ab7efcc9 include/asm-ia64/linkage.h      Jan Beulich    2006-03-24  11  
ab7efcc9 include/asm-ia64/linkage.h      Jan Beulich    2006-03-24  12  #endif
ab7efcc9 include/asm-ia64/linkage.h      Jan Beulich    2006-03-24  13  
e1b5bb6d arch/ia64/include/asm/linkage.h Al Viro        2013-01-21  14  #define cond_syscall(x) asm(".weak\t" #x "#\n" #x "#\t=\tsys_ni_syscall#")

:::::: The code at line 6 was first introduced by commit
:::::: 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 Linux-2.6.12-rc2

:::::: TO: Linus Torvalds <torvalds@ppc970.osdl.org>
:::::: CC: Linus Torvalds <torvalds@ppc970.osdl.org>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[toc] | [prev] | [next] | [standalone]


#1238501 — Re: [PATCH] percpu_counter: return precise count from __percpu_counter_compare()

Fromkbuild test robot <lkp@intel.com>
Date2015-10-02 20:20 +0200
SubjectRe: [PATCH] percpu_counter: return precise count from __percpu_counter_compare()
Message-ID<qfd62-2L2-11@gated-at.bofh.it>
In reply to#1238442

[Multipart message — attachments visible in raw view] — view raw

Hi Waiman,

[auto build test results on v4.3-rc3 -- if it's inappropriate base, please ignore]

config: m68k-sun3_defconfig (attached as .config)
reproduce:
        wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=m68k 

All error/warnings (new ones prefixed by >>):

    {
    ^
   include/linux/jump_label.h:201:42: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    static inline void jump_label_lock(void) {}
                                             ^
   include/linux/jump_label.h:202:44: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    static inline void jump_label_unlock(void) {}
                                               ^
   include/linux/jump_label.h:205:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    {
    ^
   include/linux/jump_label.h:218:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    {
    ^
   include/linux/jump_label.h:223:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    {
    ^
   include/linux/jump_label.h:233:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    {
    ^
   include/linux/jump_label.h:251:1: warning: empty declaration
    struct static_key_true {
    ^
   include/linux/jump_label.h:255:1: warning: empty declaration
    struct static_key_false {
    ^
   In file included from include/linux/vtime.h:4:0,
                    from include/linux/hardirq.h:7,
                    from include/linux/interrupt.h:12,
                    from include/linux/kernel_stat.h:8,
                    from arch/m68k/kernel/asm-offsets.c:15:
   include/linux/context_tracking_state.h:7:1: warning: empty declaration
    struct context_tracking {
    ^
   include/linux/context_tracking_state.h:43:51: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    static inline bool context_tracking_in_user(void) { return false; }
                                                      ^
   include/linux/context_tracking_state.h:44:50: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    static inline bool context_tracking_active(void) { return false; }
                                                     ^
   include/linux/context_tracking_state.h:45:54: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    static inline bool context_tracking_is_enabled(void) { return false; }
                                                         ^
   include/linux/context_tracking_state.h:46:58: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    static inline bool context_tracking_cpu_is_enabled(void) { return false; }
                                                             ^
   In file included from include/linux/hardirq.h:7:0,
                    from include/linux/interrupt.h:12,
                    from include/linux/kernel_stat.h:8,
                    from arch/m68k/kernel/asm-offsets.c:15:
   include/linux/vtime.h:10:1: warning: empty declaration
    struct task_struct;
    ^
   include/linux/vtime.h:32:51: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    static inline bool vtime_accounting_enabled(void) { return false; }
                                                      ^
   include/linux/vtime.h:69:64: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    static inline void vtime_task_switch(struct task_struct *prev) { }
                                                                   ^
   include/linux/vtime.h:70:66: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    static inline void vtime_account_system(struct task_struct *tsk) { }
                                                                     ^
   include/linux/vtime.h:71:64: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    static inline void vtime_account_user(struct task_struct *tsk) { }
                                                                   ^
   include/linux/vtime.h:72:69: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    static inline void vtime_account_irq_enter(struct task_struct *tsk) { }
                                                                        ^
   include/linux/vtime.h:96:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    {
    ^
   include/linux/vtime.h:100:62: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    static inline void vtime_user_enter(struct task_struct *tsk) { }
                                                                 ^
   include/linux/vtime.h:101:61: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    static inline void vtime_user_exit(struct task_struct *tsk) { }
                                                                ^
   include/linux/vtime.h:102:63: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    static inline void vtime_guest_enter(struct task_struct *tsk) { }
                                                                  ^
   include/linux/vtime.h:103:62: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    static inline void vtime_guest_exit(struct task_struct *tsk) { }
                                                                 ^
   include/linux/vtime.h:104:70: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    static inline void vtime_init_idle(struct task_struct *tsk, int cpu) { }
                                                                         ^
   include/linux/vtime.h:110:65: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    static inline void irqtime_account_irq(struct task_struct *tsk) { }
                                                                    ^
   include/linux/vtime.h:114:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    {
    ^
   include/linux/vtime.h:120:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    {
    ^
   In file included from arch/m68k/include/asm/hardirq.h:6:0,
                    from include/linux/hardirq.h:8,
                    from include/linux/interrupt.h:12,
                    from include/linux/kernel_stat.h:8,
                    from arch/m68k/kernel/asm-offsets.c:15:
>> arch/m68k/include/asm/irq.h:57:1: warning: empty declaration
    struct irq_data;
    ^
   arch/m68k/include/asm/irq.h:58:1: warning: empty declaration
    struct irq_chip;
    ^
   arch/m68k/include/asm/irq.h:59:1: warning: empty declaration
    struct irq_desc;
    ^
>> arch/m68k/include/asm/irq.h:60:21: error: storage class specified for parameter 'm68k_irq_startup'
    extern unsigned int m68k_irq_startup(struct irq_data *data);
                        ^
>> arch/m68k/include/asm/irq.h:61:21: error: storage class specified for parameter 'm68k_irq_startup_irq'
    extern unsigned int m68k_irq_startup_irq(unsigned int irq);
                        ^
>> arch/m68k/include/asm/irq.h:62:13: error: storage class specified for parameter 'm68k_irq_shutdown'
    extern void m68k_irq_shutdown(struct irq_data *data);
                ^
>> arch/m68k/include/asm/irq.h:63:13: error: storage class specified for parameter 'm68k_setup_auto_interrupt'
    extern void m68k_setup_auto_interrupt(void (*handler)(unsigned int,
                ^
>> arch/m68k/include/asm/irq.h:65:13: error: storage class specified for parameter 'm68k_setup_user_interrupt'
    extern void m68k_setup_user_interrupt(unsigned int vec, unsigned int cnt);
                ^
>> arch/m68k/include/asm/irq.h:66:13: error: storage class specified for parameter 'm68k_setup_irq_controller'
    extern void m68k_setup_irq_controller(struct irq_chip *,
                ^
>> arch/m68k/include/asm/irq.h:70:21: error: storage class specified for parameter 'irq_canonicalize'
    extern unsigned int irq_canonicalize(unsigned int irq);
                        ^
>> arch/m68k/include/asm/irq.h:77:17: error: storage class specified for parameter 'irq_err_count'
    extern atomic_t irq_err_count;
                    ^
   In file included from include/linux/hardirq.h:8:0,
                    from include/linux/interrupt.h:12,
                    from include/linux/kernel_stat.h:8,
                    from arch/m68k/kernel/asm-offsets.c:15:
>> arch/m68k/include/asm/hardirq.h:11:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    {
    ^
>> arch/m68k/include/asm/hardirq.h:18:25: error: storage class specified for parameter 'irq_cpustat_t'
    } ____cacheline_aligned irq_cpustat_t;
                            ^
   In file included from arch/m68k/include/asm/hardirq.h:20:0,
                    from include/linux/hardirq.h:8,
                    from include/linux/interrupt.h:12,
                    from include/linux/kernel_stat.h:8,
                    from arch/m68k/kernel/asm-offsets.c:15:
>> include/linux/irq_cpustat.h:20:22: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'irq_stat'
    extern irq_cpustat_t irq_stat[];  /* defined in asm/hardirq.h */
                         ^
   In file included from include/linux/interrupt.h:12:0,
                    from include/linux/kernel_stat.h:8,
                    from arch/m68k/kernel/asm-offsets.c:15:
   include/linux/hardirq.h:11:13: error: storage class specified for parameter 'synchronize_irq'
    extern void synchronize_irq(unsigned int irq);
                ^
   include/linux/hardirq.h:12:13: error: storage class specified for parameter 'synchronize_hardirq'
    extern bool synchronize_hardirq(unsigned int irq);
                ^
   include/linux/hardirq.h:17:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    {
    ^
   include/linux/hardirq.h:21:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    {
    ^
   include/linux/hardirq.h:45:13: error: storage class specified for parameter 'irq_enter'
    extern void irq_enter(void);
                ^
   include/linux/hardirq.h:60:13: error: storage class specified for parameter 'irq_exit'
    extern void irq_exit(void);
                ^
   In file included from include/linux/interrupt.h:15:0,
                    from include/linux/kernel_stat.h:8,
                    from arch/m68k/kernel/asm-offsets.c:15:
   include/linux/kref.h:24:1: warning: empty declaration
    struct kref {
    ^
   include/linux/kref.h:33:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    {
    ^
   include/linux/kref.h:42:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    {
    ^
   include/linux/kref.h:70:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    {
    ^
   include/linux/kref.h:98:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    {
    ^
   include/linux/kref.h:118:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    {
    ^
   include/linux/kref.h:137:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    {
    ^
   include/linux/kref.h:168:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    {
    ^
   In file included from include/linux/kernel_stat.h:8:0,
                    from arch/m68k/kernel/asm-offsets.c:15:
   include/linux/interrupt.h:87:1: warning: empty declaration
    enum {
    ^
>> include/linux/interrupt.h:92:22: error: expected declaration specifiers or '...' before '*' token
    typedef irqreturn_t (*irq_handler_t)(int, void *);
                         ^
>> include/linux/interrupt.h:110:2: error: unknown type name 'irq_handler_t'
     irq_handler_t  handler;
     ^
   include/linux/interrupt.h:114:2: error: unknown type name 'irq_handler_t'
     irq_handler_t  thread_fn;
     ^
   include/linux/interrupt.h:109:1: warning: empty declaration
    struct irqaction {
    ^
>> include/linux/interrupt.h:124:20: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'no_action'
    extern irqreturn_t no_action(int cpl, void *dev_id);
                       ^
   include/linux/interrupt.h:127:40: error: unknown type name 'irq_handler_t'
    request_threaded_irq(unsigned int irq, irq_handler_t handler,
                                           ^
   include/linux/interrupt.h:128:8: error: unknown type name 'irq_handler_t'
           irq_handler_t thread_fn,
           ^
   include/linux/interrupt.h:132:31: error: unknown type name 'irq_handler_t'
    request_irq(unsigned int irq, irq_handler_t handler, unsigned long flags,
                                  ^
   include/linux/interrupt.h:139:43: error: unknown type name 'irq_handler_t'
    request_any_context_irq(unsigned int irq, irq_handler_t handler,
                                              ^
   include/linux/interrupt.h:143:38: error: unknown type name 'irq_handler_t'
    request_percpu_irq(unsigned int irq, irq_handler_t handler,
                                         ^
   include/linux/interrupt.h:146:13: error: storage class specified for parameter 'free_irq'
    extern void free_irq(unsigned int, void *);
                ^
   include/linux/interrupt.h:147:13: error: storage class specified for parameter 'free_percpu_irq'
    extern void free_percpu_irq(unsigned int, void __percpu *);
                ^
   include/linux/interrupt.h:149:1: warning: empty declaration
    struct device;
    ^
   include/linux/interrupt.h:153:6: error: unknown type name 'irq_handler_t'
         irq_handler_t handler, irq_handler_t thread_fn,
         ^
   include/linux/interrupt.h:153:29: error: unknown type name 'irq_handler_t'
         irq_handler_t handler, irq_handler_t thread_fn,
                                ^
   include/linux/interrupt.h:158:56: error: unknown type name 'irq_handler_t'
    devm_request_irq(struct device *dev, unsigned int irq, irq_handler_t handler,
                                                           ^
   include/linux/interrupt.h:167:4: error: unknown type name 'irq_handler_t'
       irq_handler_t handler, unsigned long irqflags,
       ^
   include/linux/interrupt.h:170:13: error: storage class specified for parameter 'devm_free_irq'
    extern void devm_free_irq(struct device *dev, unsigned int irq, void *dev_id);
                ^
   include/linux/interrupt.h:190:13: error: storage class specified for parameter 'disable_irq_nosync'
    extern void disable_irq_nosync(unsigned int irq);
                ^
   include/linux/interrupt.h:191:13: error: storage class specified for parameter 'disable_hardirq'
    extern bool disable_hardirq(unsigned int irq);
                ^
   include/linux/interrupt.h:192:13: error: storage class specified for parameter 'disable_irq'
    extern void disable_irq(unsigned int irq);
                ^
   include/linux/interrupt.h:193:13: error: storage class specified for parameter 'disable_percpu_irq'
    extern void disable_percpu_irq(unsigned int irq);
                ^
   include/linux/interrupt.h:194:13: error: storage class specified for parameter 'enable_irq'
    extern void enable_irq(unsigned int irq);
                ^
   include/linux/interrupt.h:195:13: error: storage class specified for parameter 'enable_percpu_irq'
    extern void enable_percpu_irq(unsigned int irq, unsigned int type);
                ^
   include/linux/interrupt.h:196:13: error: storage class specified for parameter 'irq_wake_thread'
    extern void irq_wake_thread(unsigned int irq, void *dev_id);
                ^
   include/linux/interrupt.h:199:13: error: storage class specified for parameter 'suspend_device_irqs'
    extern void suspend_device_irqs(void);
                ^
   include/linux/interrupt.h:200:13: error: storage class specified for parameter 'resume_device_irqs'
    extern void resume_device_irqs(void);
                ^
   include/linux/interrupt.h:214:1: warning: empty declaration
    struct irq_affinity_notify {
    ^
   include/linux/interrupt.h:271:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    {
    ^
   include/linux/interrupt.h:276:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    {
    ^
   include/linux/interrupt.h:281:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    {
    ^
   include/linux/interrupt.h:285:58: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    static inline int irq_select_affinity(unsigned int irq)  { return 0; }
                                                             ^
   include/linux/interrupt.h:289:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    {
    ^
   include/linux/interrupt.h:295:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    {
    ^
   include/linux/interrupt.h:312:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    {
    ^
   include/linux/interrupt.h:320:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    {
    ^
   include/linux/interrupt.h:328:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    {
    ^
   include/linux/interrupt.h:336:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    {
..

vim +125 include/linux/percpu_counter.h

   119		else if (fbc->count < rhs)
   120			return -1;
   121		else
   122			return 0;
   123	}
   124	
 > 125	static inline int __percpu_counter_compare(struct percpu_counter *fbc, s64 rhs,
   126						   s32 batch, s64 *pcnt))
   127	{
   128		return percpu_counter_compare(fbc, rhs);

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[toc] | [prev] | [next] | [standalone]


#1238657 — Re: [PATCH] percpu_counter: return precise count from __percpu_counter_compare()

FromDave Chinner <david@fromorbit.com>
Date2015-10-03 00:20 +0200
SubjectRe: [PATCH] percpu_counter: return precise count from __percpu_counter_compare()
Message-ID<qfgQi-87k-13@gated-at.bofh.it>
In reply to#1238442
On Fri, Oct 02, 2015 at 01:29:57PM -0400, Waiman Long wrote:
> In __percpu_counter_compare(), if the current imprecise count is
> within (batch*nr_cpus) of the input value to be compared, a call
> to percpu_counter_sum() will be made to get the precise count. The
> percpu_counter_sum() call, however, can be expensive especially on
> large systems where there are a lot of CPUs. Large systems also make
> it more likely that percpu_counter_sum() will be called.
> 
> The xfs_mod_fdblocks() function calls __percpu_counter_compare()
> twice. First to see if a smaller batch size should be used for
> __percpu_counter_add() and the second call to compare the actual
> size needed. This can potentially lead to 2 calls to the expensive
> percpu_counter_sum() function.

There should not be that much overhead in __percpu_counter_compare()
through this path in normal operation. The slow path is only taken
as you near ENOSPC...

> This patch added an extra argument to __percpu_counter_compare()
> to return the precise count, if computed. The caller will need to
> initialize it to an invalid value that it can tell if the precise
> count is being returned.

This doesn't work. ENOSPC detection is a lockless algorithm that
requires absolute precision. Assuming the XFS_ALLOC_SET_ASIDE()
definition of ENOSPC is 0 blocks free, your change allows this race:

free space: 1 block

thread 1		thread 2			free space
allocate 1 block	allocate 1 block		  1
sample pcount = 1					  1
			sample pcount = 1		  1
add fdblocks, -1, 1)					  0
			add fdblocks, -1, 1)		  -1
if (pcount - 1 >= 0)	if (pcount - 1 >= 0)
   OK!			    OK!				  -1

So, we've just failed to detect ENOSPC correct. One of those two
threads should have returned ENOSPC and failed the allocation,
but instead we've just allowed XFS to allocate a block that doesn't
exist. Hence we have to resample the percpu counter after the
modification to ensure that we don't miss this race condition.

Sure, the curent code could race on the second comparisions and
return ENOSPC to both threads, but that is a perfectly OK thing
to do. It is vitally important that we don't oversubscribe
filesystem space, because that will lead to all sorts of other
problems (deadlocks, hangs, shutdowns, etc) that are very difficult
to identify the cause of.

FWIW, I'm guessing that you didn't run this patch through xfstests?
xfstests will find these ENOSPC accounting bugs, and usually quite
quickly...

> Running the AIM7 disk workload with XFS filesystem, the jobs/min
> on a 40-core 80-thread 4-socket Haswell-EX system increases from
> 3805k to 4276k (12% increase) with this patch applied. As measured
> by the perf tool, the %CPU cycle consumed by __percpu_counter_sum()
> decreases from 12.64% to 7.08%.

XFS should only hit the slow __percpu_counter_sum() path patch as
the fs gets close to ENOSPC, which for your system will be less
than:

threshold = num_online_cpus * XFS_FDBLOCKS_BATCH * 2 blocks
	  = 80 * 1024 * 2 blocks
	  = 160,000 blocks
	  = 640MB of disk space.

Having less than 1GB of free space in an XFS filesystem is
considered to be "almost ENOSPC" - when you have TB to PB of space,
less than 1GB really "moments before ENOSPC".

XFS trades off low overhead for fast path allocation  with slowdowns
as we near ENOSPC in allocation routines. It gets harder to find
contiguous free space, files get more fragmented, IO takes longer
because we seek more, etc. Hence we accept that performance slows
down as as the need for precision increases as we near ENOSPC.

I'd suggest you retry your benchmark with larger filesystems, and
see what happens...

Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web