Commit dbeccabf authored by NeilBrown's avatar NeilBrown Committed by Greg Kroah-Hartman

staging: lustre: disable preempt while sampling processor id.

Calling smp_processor_id() without disabling preemption
triggers a warning (if CONFIG_DEBUG_PREEMPT).
I think the result of cfs_cpt_current() is only used as a hint for
load balancing, rather than as a precise and stable indicator of
the current CPU.  So it doesn't need to be called with
preemption disabled.

So disable preemption inside cfs_cpt_current() to silence the warning.
Signed-off-by: default avatarNeilBrown <neilb@suse.com>
Reviewed-by: default avatarAndreas Dilger <andreas.dilger@intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 213b14b1
...@@ -529,19 +529,20 @@ EXPORT_SYMBOL(cfs_cpt_spread_node); ...@@ -529,19 +529,20 @@ EXPORT_SYMBOL(cfs_cpt_spread_node);
int int
cfs_cpt_current(struct cfs_cpt_table *cptab, int remap) cfs_cpt_current(struct cfs_cpt_table *cptab, int remap)
{ {
int cpu = smp_processor_id(); int cpu;
int cpt = cptab->ctb_cpu2cpt[cpu]; int cpt;
if (cpt < 0) { preempt_disable();
if (!remap) cpu = smp_processor_id();
return cpt; cpt = cptab->ctb_cpu2cpt[cpu];
if (cpt < 0 && remap) {
/* don't return negative value for safety of upper layer, /* don't return negative value for safety of upper layer,
* instead we shadow the unknown cpu to a valid partition ID * instead we shadow the unknown cpu to a valid partition ID
*/ */
cpt = cpu % cptab->ctb_nparts; cpt = cpu % cptab->ctb_nparts;
} }
preempt_enable();
return cpt; return cpt;
} }
EXPORT_SYMBOL(cfs_cpt_current); EXPORT_SYMBOL(cfs_cpt_current);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment