Commit 0cd85e67 authored by Motohiro KOSAKI's avatar Motohiro KOSAKI Committed by Roland Dreier

IB/qib: Convert old cpumask api into new one

Adapt to use new APIs.  We plan to remove old one later and plan to
change current->cpus_allowed implementation.

No functional change.
Signed-off-by: default avatarKOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Acked-by: default avatarMike Marciniszyn <mike.marciniszyn@qlogic.com>
Signed-off-by: default avatarRoland Dreier <roland@purestorage.com>
parent 52a09a04
...@@ -1527,6 +1527,7 @@ static int qib_assign_ctxt(struct file *fp, const struct qib_user_info *uinfo) ...@@ -1527,6 +1527,7 @@ static int qib_assign_ctxt(struct file *fp, const struct qib_user_info *uinfo)
struct qib_filedata *fd = fp->private_data; struct qib_filedata *fd = fp->private_data;
const struct qib_ctxtdata *rcd = fd->rcd; const struct qib_ctxtdata *rcd = fd->rcd;
const struct qib_devdata *dd = rcd->dd; const struct qib_devdata *dd = rcd->dd;
unsigned int weight;
if (dd->flags & QIB_HAS_SEND_DMA) { if (dd->flags & QIB_HAS_SEND_DMA) {
fd->pq = qib_user_sdma_queue_create(&dd->pcidev->dev, fd->pq = qib_user_sdma_queue_create(&dd->pcidev->dev,
...@@ -1545,8 +1546,8 @@ static int qib_assign_ctxt(struct file *fp, const struct qib_user_info *uinfo) ...@@ -1545,8 +1546,8 @@ static int qib_assign_ctxt(struct file *fp, const struct qib_user_info *uinfo)
* it just means that sooner or later we don't recommend * it just means that sooner or later we don't recommend
* a cpu, and let the scheduler do it's best. * a cpu, and let the scheduler do it's best.
*/ */
if (!ret && cpus_weight(current->cpus_allowed) >= weight = cpumask_weight(tsk_cpus_allowed(current));
qib_cpulist_count) { if (!ret && weight >= qib_cpulist_count) {
int cpu; int cpu;
cpu = find_first_zero_bit(qib_cpulist, cpu = find_first_zero_bit(qib_cpulist,
qib_cpulist_count); qib_cpulist_count);
...@@ -1554,13 +1555,13 @@ static int qib_assign_ctxt(struct file *fp, const struct qib_user_info *uinfo) ...@@ -1554,13 +1555,13 @@ static int qib_assign_ctxt(struct file *fp, const struct qib_user_info *uinfo)
__set_bit(cpu, qib_cpulist); __set_bit(cpu, qib_cpulist);
fd->rec_cpu_num = cpu; fd->rec_cpu_num = cpu;
} }
} else if (cpus_weight(current->cpus_allowed) == 1 && } else if (weight == 1 &&
test_bit(first_cpu(current->cpus_allowed), test_bit(cpumask_first(tsk_cpus_allowed(current)),
qib_cpulist)) qib_cpulist))
qib_devinfo(dd->pcidev, "%s PID %u affinity " qib_devinfo(dd->pcidev, "%s PID %u affinity "
"set to cpu %d; already allocated\n", "set to cpu %d; already allocated\n",
current->comm, current->pid, current->comm, current->pid,
first_cpu(current->cpus_allowed)); cpumask_first(tsk_cpus_allowed(current)));
} }
mutex_unlock(&qib_mutex); mutex_unlock(&qib_mutex);
......
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