Skip to content

resource: find_next_iomem_res() improvements

Nadav Amit linux-mm lkml stable 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest3 patches 26 repliesIn review 1 of 3 applied

Patches in v1 1 of 3 applied

#Subject and filesSizeRepliesApplied
1/3resource: Fix locking in find_next_iomem_res()kernel/resource.c+9 -95 repliesApplied
2/3resource: Avoid unnecessary lookups in find_next_iomem_res()kernel/resource.c+22 -70 replies
3/3resource: Introduce resource cachekernel/resource.c+49 -210 replies

Reviews trailers per patch

None of the 3 patches has a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchDan Williams
SeriesR-b
1/3
2/3
3/3

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 0/3] resource: find_next_iomem_res() improvements

Running some microbenchmarks on dax keeps showing find_next_iomem_res() as a place in which significant amount of time is spent. It appears that in order to determine the cacheability that is required for the PTE, lookup_memtype() is called, and this one traverses the resources list in an inefficient manner. This patch-set tries to improve this situation.

The first patch fixes what appears to be unsafe locking in find_next_iomem_res().

The second patch improves performance by searching the top level first, to find a matching range, before going down to the children. The third patch improves the performance by caching the top level resource of the last found resource in find_next_iomem_res().

Both of these optimizations are based on the ranges in the top level not overlapping each other.

Running sysbench on dax (Haswell, pmem emulation, with write_cache disabled):

  sysbench fileio --file-total-size=3G --file-test-mode=rndwr \
   --file-io-mode=mmap --threads=4 --file-fsync-mode=fdatasync run

Provides the following results:

		events (avg/stddev)
		-------------------

5.2-rc3: 1247669.0000/16075.39
+patches: 1293408.5000/7720.69 (+3.5%)

Cc Borislav Petkov <[email protected]>
Cc Toshi Kani <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Dave Hansen <[email protected]>
Cc Dan Williams <[email protected]>
Cc Bjorn Helgaas <[email protected]>
Cc Ingo Molnar <[email protected]>

Nadav Amit (3):
resource: Fix locking in find_next_iomem_res()
resource: Avoid unnecessary lookups in find_next_iomem_res()
resource: Introduce resource cache

 kernel/resource.c | 96 ++++++++++++++++++++++++++++++++++++++---------
 1 file changed, 79 insertions(+), 17 deletions(-)
Signature · 1 line
2.20.1