Skip to content

Misc page alloc, shmem, mark_page_accessed and page_waitqueue optimisations v3r33

Mel Gorman linux-fsdevel linux-mm lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest19 patches 42 repliesIn review

Changelog since V2 from the cover letter

o Fewer atomic operations in buffer discards (mgorman)
o Remove number_of_cpusets and use ref count in jump labels (peterz)
o Optimise set loop for pageblock flags further (peterz)
o Remove unnecessary parameters when setting pageblock flags (vbabka)
o Rework how PG_waiters are set/cleared to avoid changing wait.c (mgorman)

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/19mm: page_alloc: Do not update zlc unless the zlc is activemm/page_alloc.c+1 -10 replies
2/19mm: page_alloc: Do not treat a zone that cannot be used for dirty pages as "full"mm/page_alloc.c+1 -10 replies
3/19jump_label: Expose the reference countinclude/linux/jump_label.h+13 -70 replies
4/19mm: page_alloc: Use jump labels to avoid checking number_of_cpusetsinclude/linux/cpuset.h kernel/cpuset.c mm/page_alloc.c+55 -42 replies
5/19mm: page_alloc: Calculate classzone_idx once from the zonelist refmm/page_alloc.c+32 -233 replies
6/19mm: page_alloc: Only check the zone id check if pages are buddiesmm/page_alloc.c+13 -30 replies
7/19mm: page_alloc: Only check the alloc flags and gfp_mask for dirty oncemm/page_alloc.c+3 -20 replies
8/19mm: page_alloc: Take the ALLOC_NO_WATERMARK check out of the fast pathmm/page_alloc.c+5 -30 replies
9/19mm: page_alloc: Use word-based accesses for get/set pageblock bitmapsinclude/linux/mmzone.h include/linux/pageblock-flags.h mm/page_alloc.c+68 -273 replies
10/19mm: page_alloc: Reduce number of times page_to_pfn is calledinclude/linux/mmzone.h include/linux/pageblock-flags.h mm/page_alloc.c+39 -372 replies
11/19mm: page_alloc: Lookup pageblock migratetype with IRQs enabled during freemm/page_alloc.c+1 -12 replies
12/19mm: page_alloc: Use unsigned int for order in more placesinclude/linux/mmzone.h mm/page_alloc.c+27 -240 replies
13/19mm: page_alloc: Convert hot/cold parameter and immediate callers to boolarch/tile/mm/homecache.c fs/fuse/dev.c include/linux/gfp.h +6 more+22 -220 replies
14/19mm: shmem: Avoid atomic operation during shmem_getpage_gfpinclude/linux/page-flags.h mm/shmem.c+2 -10 replies
15/19mm: Do not use atomic operations when releasing pagesmm/swap.c+1 -10 replies
16/19mm: Do not use unnecessary atomic operations when adding pages to the LRUinclude/linux/swap.h+4 -20 replies
17/19fs: buffer: Do not use unnecessary atomic operations when discarding buffersfs/buffer.c include/linux/buffer_head.h+14 -59 replies
18/19mm: Non-atomically mark page accessed during page cache allocation where possiblefs/btrfs/extent_io.c fs/btrfs/file.c fs/buffer.c +14 more+217 -1627 replies
19/19mm: filemap: Avoid unnecessary barries and waitqueue lookups in unlock_page fastpathinclude/linux/page-flags.h include/linux/pagemap.h mm/filemap.c +3 more+196 -2054 replies

Reviews trailers per patch

17 of 19 patches have a Reviewed-by or Acked-by.

PatchJohannes WeinerRik van RielVlastimil BabkaJan KaraTheodore Ts'oMel GormanLad, Prabhakar
1/19A-b R-b
2/19A-b R-b
3/19
4/19R-b R-b
5/19A-b A-b
6/19A-b A-b
7/19A-b R-b
8/19A-b R-b
9/19A-b Reported-and-tested-by
10/19A-b A-b
11/19A-b A-b
12/19A-b
13/19A-b
14/19A-b A-b
15/19A-b
16/19A-b
17/19R-b
18/19A-b A-b Reported-and-Tested-by
19/19

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 7 reviewers.

Read the v1 thread

Cover letter [PATCH 00/19] Misc page alloc, shmem, mark_page_accessed and page_waitqueue optimisations v3r33

Changelog since V2
o Fewer atomic operations in buffer discards (mgorman)
o Remove number_of_cpusets and use ref count in jump labels (peterz)
o Optimise set loop for pageblock flags further (peterz)
o Remove unnecessary parameters when setting pageblock flags (vbabka)
o Rework how PG_waiters are set/cleared to avoid changing wait.c (mgorman)

I was investigating a performance bug that looked like dd to tmpfs had regressed. The bulk of the problem turned out to be a difference in Kconfig but it got me looking at the unnecessary overhead in tmpfs, mark_page_accessed and parts of the allocator. This series is the result.

The patches themselves have details of the performance results but here are a few showing the impact of the whole series. This is the result of dd'ing to a file multiple times on tmpfs

sync DD to tmpfs
Throughput 3.15.0-rc4 3.15.0-rc4
vanilla fullseries-v3

Min         4096.0000 (  0.00%)   4300.8000 (  5.00%)
Mean        4785.4933 (  0.00%)   5003.9467 (  4.56%)
TrimMean    4812.8000 (  0.00%)   5028.5714 (  4.48%)
Stddev       147.0509 (  0.00%)    191.9981 ( 30.57%)
Max         5017.6000 (  0.00%)   5324.8000 (  6.12%)

sync DD to tmpfs
Elapsed Time 3.15.0-rc4 3.15.0-rc4
vanilla fullseries-v3

Min      elapsed      0.4200 (  0.00%)      0.3900 (  7.14%)
Mean     elapsed      0.4947 (  0.00%)      0.4527 (  8.49%)
TrimMean elapsed      0.4968 (  0.00%)      0.4539 (  8.63%)
Stddev   elapsed      0.0255 (  0.00%)      0.0340 (-33.02%)
Max      elapsed      0.5200 (  0.00%)      0.4800 (  7.69%)
TrimMean elapsed      0.4796 (  0.00%)      0.4179 ( 12.88%)
Stddev   elapsed      0.0353 (  0.00%)      0.0379 ( -7.23%)
Max      elapsed      0.5100 (  0.00%)      0.4800 (  5.88%)

sync DD to ext4
Throughput 3.15.0-rc4 3.15.0-rc4
vanilla fullseries-v3

Min          113.0000 (  0.00%)    117.0000 (  3.54%)
Mean         116.3000 (  0.00%)    119.6667 (  2.89%)
TrimMean     116.2857 (  0.00%)    119.5714 (  2.83%)
Stddev         1.6961 (  0.00%)      1.1643 (-31.35%)
Max          120.0000 (  0.00%)    122.0000 (  1.67%)

sync DD to ext4
Elapsed time 3.15.0-rc4 3.15.0-rc4
vanilla fullseries-v3

Min      elapsed     13.9500 (  0.00%)     13.6900 (  1.86%)
Mean     elapsed     14.4253 (  0.00%)     14.0010 (  2.94%)
TrimMean elapsed     14.4321 (  0.00%)     14.0161 (  2.88%)
Stddev   elapsed      0.2047 (  0.00%)      0.1423 ( 30.46%)
Max      elapsed     14.8300 (  0.00%)     14.3100 (  3.51%)

async DD to ext4
Elapsed time 3.15.0-rc4 3.15.0-rc4
vanilla fullseries-v3

Min      elapsed      0.7900 (  0.00%)      0.7800 (  1.27%)
Mean     elapsed     12.4023 (  0.00%)     12.2957 (  0.86%)
TrimMean elapsed     13.2036 (  0.00%)     13.0918 (  0.85%)
Stddev   elapsed      3.3286 (  0.00%)      2.9842 ( 10.35%)
Max      elapsed     18.6000 (  0.00%)     13.4300 ( 27.80%)

This table shows the latency in usecs of accessing ext4-backed mappings of various sizes

lat_mmap

                       3.15.0-rc4            3.15.0-rc4
                          vanilla         fullseries-v3
Procs 107M     564.0000 (  0.00%)    546.0000 (  3.19%)
Procs 214M    1123.0000 (  0.00%)   1090.0000 (  2.94%)
Procs 322M    1636.0000 (  0.00%)   1395.0000 ( 14.73%)
Procs 429M    2076.0000 (  0.00%)   2051.0000 (  1.20%)
Procs 536M    2518.0000 (  0.00%)   2482.0000 (  1.43%)
Procs 644M    3008.0000 (  0.00%)   2978.0000 (  1.00%)
Procs 751M    3506.0000 (  0.00%)   3450.0000 (  1.60%)
Procs 859M    3988.0000 (  0.00%)   3756.0000 (  5.82%)
Procs 966M    4544.0000 (  0.00%)   4310.0000 (  5.15%)
Procs 1073M   4960.0000 (  0.00%)   4928.0000 (  0.65%)
Procs 1181M   5342.0000 (  0.00%)   5144.0000 (  3.71%)
Procs 1288M   5573.0000 (  0.00%)   5427.0000 (  2.62%)
Procs 1395M   5777.0000 (  0.00%)   6056.0000 ( -4.83%)
Procs 1503M   6141.0000 (  0.00%)   5963.0000 (  2.90%)
Procs 1610M   6689.0000 (  0.00%)   6331.0000 (  5.35%)
Procs 1717M   8839.0000 (  0.00%)   6807.0000 ( 22.99%)
Procs 1825M   8399.0000 (  0.00%)   9062.0000 ( -7.89%)
Procs 1932M   7871.0000 (  0.00%)   8778.0000 (-11.52%)
Procs 2040M   8235.0000 (  0.00%)   8081.0000 (  1.87%)
Procs 2147M   8861.0000 (  0.00%)   8337.0000 (  5.91%)

In general the system CPU overhead is lower.

 arch/tile/mm/homecache.c        |   2 +-
 fs/btrfs/extent_io.c            |  11 +-
 fs/btrfs/file.c                 |   5 +-
 fs/buffer.c                     |  21 ++-
 fs/ext4/mballoc.c               |  14 +-
 fs/f2fs/checkpoint.c            |   3 -
 fs/f2fs/node.c                  |   2 -
 fs/fuse/dev.c                   |   2 +-
 fs/fuse/file.c                  |   2 -
 fs/gfs2/aops.c                  |   1 -
 fs/gfs2/meta_io.c               |   4 +-
 fs/ntfs/attrib.c                |   1 -
 fs/ntfs/file.c                  |   1 -
 include/linux/buffer_head.h     |   5 +
 include/linux/cpuset.h          |  46 +++++
 include/linux/gfp.h             |   4 +-
 include/linux/jump_label.h      |  20 ++-
 include/linux/mmzone.h          |  21 ++-
 include/linux/page-flags.h      |  20 +++
 include/linux/pageblock-flags.h |  30 +++-
 include/linux/pagemap.h         | 115 +++++++++++-
 include/linux/swap.h            |   9 +-
 kernel/cpuset.c                 |  10 +-
 mm/filemap.c                    | 380 +++++++++++++++++++++++++---------------
 mm/page_alloc.c                 | 229 ++++++++++++++----------
 mm/shmem.c                      |   8 +-
 mm/swap.c                       |  27 ++-
 mm/swap_state.c                 |   2 +-
 mm/vmscan.c                     |   9 +-
 29 files changed, 686 insertions(+), 318 deletions(-)
Signature · 7 lines
1.8.4.5

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>