Disable preemption during tasklet schedule for per-CPU variable usage

git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6206 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
Vladislav Bolkhovitin
2015-05-09 03:17:16 +00:00
parent 93dc546f3b
commit dd3799d62a

View File

@@ -73,9 +73,13 @@ EXPORT_SYMBOL_GPL(scst_post_alloc_data_buf);
static inline void scst_schedule_tasklet(struct scst_cmd *cmd)
{
struct scst_percpu_info *i = &scst_percpu_infos[smp_processor_id()];
struct scst_percpu_info *i;
unsigned long flags;
preempt_disable();
i = &scst_percpu_infos[smp_processor_id()];
if (atomic_read(&i->cpu_cmd_count) <= scst_max_tasklet_cmd) {
spin_lock_irqsave(&i->tasklet_lock, flags);
TRACE_DBG("Adding cmd %p to tasklet %d cmd list", cmd,
@@ -93,6 +97,8 @@ static inline void scst_schedule_tasklet(struct scst_cmd *cmd)
wake_up(&cmd->cmd_threads->cmd_list_waitQ);
spin_unlock_irqrestore(&cmd->cmd_threads->cmd_list_lock, flags);
}
preempt_enable();
return;
}