diff options
author | Mateusz Guzik <[email protected]> | 2020-11-02 20:51:12 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2020-11-02 11:51:12 -0800 |
commit | 09eb36ce3d98e0eeaeec9c333ac818b2bc3f85bf (patch) | |
tree | 967d479b3fe081cc9e6cdd2d6ffc4daa412fc7d0 /include | |
parent | 8583540c6e04135626fe301ace8aa51212826965 (diff) |
Introduce CPU_SEQID_UNSTABLE
Current CPU_SEQID users don't care about possibly changing CPU ID, but
enclose it within kpreempt disable/enable in order to fend off warnings
from Linux's CONFIG_DEBUG_PREEMPT.
There is no need to do it. The expected way to get CPU ID while allowing
for migration is to use raw_smp_processor_id.
In order to make this future-proof this patch keeps CPU_SEQID as is and
introduces CPU_SEQID_UNSTABLE instead, to make it clear that consumers
explicitly want this behavior.
Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Ryan Moeller <[email protected]>
Reviewed-by: Matt Macy <[email protected]>
Signed-off-by: Mateusz Guzik <[email protected]>
Closes #11142
Diffstat (limited to 'include')
-rw-r--r-- | include/os/freebsd/spl/sys/sysmacros.h | 1 | ||||
-rw-r--r-- | include/os/linux/spl/sys/sysmacros.h | 1 | ||||
-rw-r--r-- | include/sys/zfs_context.h | 1 |
3 files changed, 3 insertions, 0 deletions
diff --git a/include/os/freebsd/spl/sys/sysmacros.h b/include/os/freebsd/spl/sys/sysmacros.h index 2d0164cb1..7e3ab8915 100644 --- a/include/os/freebsd/spl/sys/sysmacros.h +++ b/include/os/freebsd/spl/sys/sysmacros.h @@ -80,6 +80,7 @@ extern "C" { #define kpreempt_disable() critical_enter() #define kpreempt_enable() critical_exit() #define CPU_SEQID curcpu +#define CPU_SEQID_UNSTABLE curcpu #define is_system_labeled() 0 /* * Convert a single byte to/from binary-coded decimal (BCD). diff --git a/include/os/linux/spl/sys/sysmacros.h b/include/os/linux/spl/sys/sysmacros.h index eb3494bc7..98d1ab1d7 100644 --- a/include/os/linux/spl/sys/sysmacros.h +++ b/include/os/linux/spl/sys/sysmacros.h @@ -76,6 +76,7 @@ #define max_ncpus num_possible_cpus() #define boot_ncpus num_online_cpus() #define CPU_SEQID smp_processor_id() +#define CPU_SEQID_UNSTABLE raw_smp_processor_id() #define is_system_labeled() 0 #ifndef RLIM64_INFINITY diff --git a/include/sys/zfs_context.h b/include/sys/zfs_context.h index 9f637036e..ee3216d67 100644 --- a/include/sys/zfs_context.h +++ b/include/sys/zfs_context.h @@ -626,6 +626,7 @@ extern void delay(clock_t ticks); #define defclsyspri 0 #define CPU_SEQID ((uintptr_t)pthread_self() & (max_ncpus - 1)) +#define CPU_SEQID_UNSTABLE CPU_SEQID #define kcred NULL #define CRED() NULL |