scst: Introduce scst_set_thr_cpu_mask()

This patch does not change any functionality.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@5685 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
Vladislav Bolkhovitin
2014-07-19 04:11:39 +00:00
parent ee2b9c3a9d
commit 5a4571354b
3 changed files with 29 additions and 10 deletions

View File

@@ -1914,6 +1914,9 @@ struct scst_cmd_threads {
struct list_head lists_list_entry;
};
int scst_set_thr_cpu_mask(struct scst_cmd_threads *cmd_threads,
cpumask_t *cpu_mask);
/*
* Used to execute cmd's in order of arrival, honoring SCSI task attributes
*/

View File

@@ -1992,6 +1992,26 @@ out:
return;
}
/* scst_mutex supposed to be held */
int scst_set_thr_cpu_mask(struct scst_cmd_threads *cmd_threads,
cpumask_t *cpu_mask)
{
struct scst_cmd_thread_t *thr;
int rc = 0;
lockdep_assert_held(&scst_mutex);
list_for_each_entry(thr, &cmd_threads->threads_list,
thread_list_entry) {
rc = set_cpus_allowed_ptr(thr->cmd_thread, cpu_mask);
if (rc)
break;
}
return rc;
}
EXPORT_SYMBOL(scst_set_thr_cpu_mask);
/* The activity supposed to be suspended and scst_mutex held */
void scst_stop_dev_threads(struct scst_device *dev)
{

View File

@@ -1916,18 +1916,14 @@ static int __scst_acg_process_cpu_mask_store(struct scst_tgt *tgt,
struct list_head *head = &sess->sess_tgt_dev_list[i];
list_for_each_entry(tgt_dev, head,
sess_tgt_dev_list_entry) {
struct scst_cmd_thread_t *thr;
int rc;
if (tgt_dev->active_cmd_threads != &tgt_dev->tgt_dev_cmd_threads)
continue;
list_for_each_entry(thr,
&tgt_dev->active_cmd_threads->threads_list,
thread_list_entry) {
int rc;
rc = set_cpus_allowed_ptr(thr->cmd_thread, cpu_mask);
if (rc != 0)
PRINT_ERROR("Setting CPU "
"affinity failed: %d", rc);
}
rc = scst_set_thr_cpu_mask(tgt_dev->active_cmd_threads, cpu_mask);
if (rc != 0)
PRINT_ERROR("Setting CPU affinity"
" failed: %d", rc);
}
}
if (tgt->tgtt->report_aen != NULL) {