~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/kernel/locking/lock_events.h

Version: ~ [ linux-6.6-rc4 ] ~ [ linux-6.5.5 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.55 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.133 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.197 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.257 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.295 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.326 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* SPDX-License-Identifier: GPL-2.0 */
  2 /*
  3  * This program is free software; you can redistribute it and/or modify
  4  * it under the terms of the GNU General Public License as published by
  5  * the Free Software Foundation; either version 2 of the License, or
  6  * (at your option) any later version.
  7  *
  8  * This program is distributed in the hope that it will be useful,
  9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
 10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 11  * GNU General Public License for more details.
 12  *
 13  * Authors: Waiman Long <longman@redhat.com>
 14  */
 15 
 16 #ifndef __LOCKING_LOCK_EVENTS_H
 17 #define __LOCKING_LOCK_EVENTS_H
 18 
 19 enum lock_events {
 20 
 21 #include "lock_events_list.h"
 22 
 23         lockevent_num,  /* Total number of lock event counts */
 24         LOCKEVENT_reset_cnts = lockevent_num,
 25 };
 26 
 27 #ifdef CONFIG_LOCK_EVENT_COUNTS
 28 /*
 29  * Per-cpu counters
 30  */
 31 DECLARE_PER_CPU(unsigned long, lockevents[lockevent_num]);
 32 
 33 /*
 34  * Increment the statistical counters. use raw_cpu_inc() because of lower
 35  * overhead and we don't care if we loose the occasional update.
 36  */
 37 static inline void __lockevent_inc(enum lock_events event, bool cond)
 38 {
 39         if (cond)
 40                 raw_cpu_inc(lockevents[event]);
 41 }
 42 
 43 #define lockevent_inc(ev)         __lockevent_inc(LOCKEVENT_ ##ev, true)
 44 #define lockevent_cond_inc(ev, c) __lockevent_inc(LOCKEVENT_ ##ev, c)
 45 
 46 static inline void __lockevent_add(enum lock_events event, int inc)
 47 {
 48         raw_cpu_add(lockevents[event], inc);
 49 }
 50 
 51 #define lockevent_add(ev, c)    __lockevent_add(LOCKEVENT_ ##ev, c)
 52 
 53 #else  /* CONFIG_LOCK_EVENT_COUNTS */
 54 
 55 #define lockevent_inc(ev)
 56 #define lockevent_add(ev, c)
 57 #define lockevent_cond_inc(ev, c)
 58 
 59 #endif /* CONFIG_LOCK_EVENT_COUNTS */
 60 #endif /* __LOCKING_LOCK_EVENTS_H */
 61 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

osdn.jp