Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

RDMA/mlx5: Introduce ODP prefetch counter

For debugging purpose it will be easier to understand if prefetch works
okay if it has its own counter. Introduce ODP prefetch counter and count
per MR the total number of prefetched pages.

In addition remove comment which is not relevant anymore and anyway not in
the correct place.

Link: https://lore.kernel.org/r/20200621104147.53795-1-leon@kernel.org
Signed-off-by: Maor Gottlieb <maorg@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>

authored by

Maor Gottlieb and committed by
Jason Gunthorpe
d473f4dc 0cb42c02

+14 -9
+10 -9
drivers/infiniband/hw/mlx5/odp.c
··· 913 913 if (ret < 0) 914 914 goto srcu_unlock; 915 915 916 - /* 917 - * When prefetching a page, page fault is generated 918 - * in order to bring the page to the main memory. 919 - * In the current flow, page faults are being counted. 920 - */ 921 916 mlx5_update_odp_stats(mr, faults, ret); 922 917 923 918 npages += ret; ··· 1750 1755 struct prefetch_mr_work *work = 1751 1756 container_of(w, struct prefetch_mr_work, work); 1752 1757 u32 bytes_mapped = 0; 1758 + int ret; 1753 1759 u32 i; 1754 1760 1755 - for (i = 0; i < work->num_sge; ++i) 1756 - pagefault_mr(work->frags[i].mr, work->frags[i].io_virt, 1757 - work->frags[i].length, &bytes_mapped, 1758 - work->pf_flags); 1761 + for (i = 0; i < work->num_sge; ++i) { 1762 + ret = pagefault_mr(work->frags[i].mr, work->frags[i].io_virt, 1763 + work->frags[i].length, &bytes_mapped, 1764 + work->pf_flags); 1765 + if (ret <= 0) 1766 + continue; 1767 + mlx5_update_odp_stats(work->frags[i].mr, prefetch, ret); 1768 + } 1759 1769 1760 1770 destroy_prefetch_work(work); 1761 1771 } ··· 1818 1818 &bytes_mapped, pf_flags); 1819 1819 if (ret < 0) 1820 1820 goto out; 1821 + mlx5_update_odp_stats(mr, prefetch, ret); 1821 1822 } 1822 1823 ret = 0; 1823 1824
+3
drivers/infiniband/hw/mlx5/restrack.c
··· 99 99 msg, "page_invalidations", 100 100 atomic64_read(&mr->odp_stats.invalidations))) 101 101 goto err_table; 102 + if (rdma_nl_stat_hwcounter_entry(msg, "page_prefetch", 103 + atomic64_read(&mr->odp_stats.prefetch))) 104 + goto err_table; 102 105 103 106 nla_nest_end(msg, table_attr); 104 107 return 0;
+1
include/rdma/ib_verbs.h
··· 2271 2271 struct ib_odp_counters { 2272 2272 atomic64_t faults; 2273 2273 atomic64_t invalidations; 2274 + atomic64_t prefetch; 2274 2275 }; 2275 2276 2276 2277 struct ib_counters {