From 5ac582a6786d8b594226cecc767acd4694b5e672 Mon Sep 17 00:00:00 2001 From: Balazs Gerofi Date: Thu, 17 Aug 2017 22:27:58 +0900 Subject: [PATCH] user_sdma_send_pkts(): unlikely() around slow path condition --- kernel/user_sdma.c | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/kernel/user_sdma.c b/kernel/user_sdma.c index 49f8ffb8..aac4164a 100644 --- a/kernel/user_sdma.c +++ b/kernel/user_sdma.c @@ -1343,7 +1343,10 @@ static int user_sdma_send_pkts(struct user_sdma_request *req, unsigned maxpkts) TP("+ If the request contains any data vectors, add up to fragsize bytes to the descriptor."); while (queued < datalen && (req->sent + data_sent) < req->data_len) { - unsigned pageidx, len; +#ifdef __HFI1_ORIG__ + unsigned pageidx; +#endif + unsigned len; unsigned long base, offset; void *virt; pte_t *ptep; @@ -1354,12 +1357,12 @@ static int user_sdma_send_pkts(struct user_sdma_request *req, unsigned maxpkts) /* * Resolve base_phys if vaddr is out of previous page. */ - if (virt < base_virt || - virt > (base_virt + base_pgsize)) { + if (unlikely(virt < base_virt || + virt > (base_virt + base_pgsize))) { ptep = ihk_mc_pt_lookup_pte( cpu_local_var(current)->vm->address_space->page_table, virt, 0, 0, &base_pgsize, 0); - if (!ptep || !pte_is_present(ptep)) { + if (unlikely(!ptep || !pte_is_present(ptep))) { kprintf("%s: ERROR: no valid PTE for 0x%lx\n", __FUNCTION__, virt); return -EFAULT; @@ -1386,10 +1389,11 @@ static int user_sdma_send_pkts(struct user_sdma_request *req, unsigned maxpkts) * doesn't like it if the physical range in an SDMA * descriptor crosses page boundaries?? */ + /* len = virt + req->info.fragsize > base_virt + base_pgsize ? base_virt + base_pgsize - virt : req->info.fragsize; - + */ offset = offset_in_page(base + iovec->offset + iov_offset); len = offset + req->info.fragsize > PAGE_SIZE ? @@ -1460,8 +1464,12 @@ static int user_sdma_send_pkts(struct user_sdma_request *req, unsigned maxpkts) dosend: ret = sdma_send_txlist(req->sde, - iowait_get_ib_work(&pq->busy), - &req->txps, &count); +#ifdef __HFI1_ORIG__ + iowait_get_ib_work(&pq->busy), +#else + NULL, +#endif + &req->txps, &count); req->seqsubmitted += count; if (req->seqsubmitted == req->info.npkts) { set_bit(SDMA_REQ_SEND_DONE, &req->flags); @@ -1471,10 +1479,8 @@ dosend: * happen due to the sequential manner in which * descriptors are processed. */ -#ifdef __HFI1_ORIG__ if (test_bit(SDMA_REQ_HAVE_AHG, &req->flags)) sdma_ahg_free(req->sde, req->ahg_idx); -#endif /* __HFI1_ORIG__ */ } hfi1_cdbg(AIOWRITE, "-"); TP("-");