27 Oct, 2010

11 commits

  • When a page has PG_referenced, shrink_page_list() discards it only if it
    is not dirty. This rule works fine if the backing filesystem is a regular
    one. PG_dirty is a good signal that the page was used recently because
    the flusher threads clean pages periodically. In addition, page writeback
    is costlier than simple page discard.

    However, when a page is on tmpfs this heuristic doesn't work because
    flusher threads don't write back tmpfs pages. Consequently tmpfs pages
    always rotate around the lru twice at least and adds unnecessary lru
    churn. Simple tmpfs streaming io shouldn't cause large anonymous page
    swap-out.

    Remove this unncessary reclaim bonus of tmpfs pages.

    Signed-off-by: KOSAKI Motohiro
    Cc: Hugh Dickins
    Reviewed-by: Johannes Weiner
    Reviewed-by: Rik van Riel
    Cc: Minchan Kim
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    KOSAKI Motohiro
     
  • …r if significant congestion is not being encountered in the current zone

    If congestion_wait() is called with no BDI congested, the caller will
    sleep for the full timeout and this may be an unnecessary sleep. This
    patch adds a wait_iff_congested() that checks congestion and only sleeps
    if a BDI is congested else, it calls cond_resched() to ensure the caller
    is not hogging the CPU longer than its quota but otherwise will not sleep.

    This is aimed at reducing some of the major desktop stalls reported during
    IO. For example, while kswapd is operating, it calls congestion_wait()
    but it could just have been reclaiming clean page cache pages with no
    congestion. Without this patch, it would sleep for a full timeout but
    after this patch, it'll just call schedule() if it has been on the CPU too
    long. Similar logic applies to direct reclaimers that are not making
    enough progress.

    Signed-off-by: Mel Gorman <mel@csn.ul.ie>
    Cc: Johannes Weiner <hannes@cmpxchg.org>
    Cc: Minchan Kim <minchan.kim@gmail.com>
    Cc: Wu Fengguang <fengguang.wu@intel.com>
    Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
    Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
    Cc: Rik van Riel <riel@redhat.com>
    Cc: Jens Axboe <axboe@kernel.dk>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

    Mel Gorman
     
  • isolate_lru_pages() does not just isolate LRU tail pages, but also
    isolates neighbour pages of the eviction page. The neighbour search does
    not stop even if neighbours cannot be isolated which is excessive as the
    lumpy reclaim will no longer result in a successful higher order
    allocation. This patch stops the PFN neighbour pages if an isolation
    fails and moves on to the next block.

    Signed-off-by: KOSAKI Motohiro
    Signed-off-by: Mel Gorman
    Reviewed-by: Wu Fengguang
    Reviewed-by: Minchan Kim
    Reviewed-by: KAMEZAWA Hiroyuki
    Cc: Johannes Weiner
    Cc: Rik van Riel
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    KOSAKI Motohiro
     
  • After synchrounous lumpy reclaim, the page_list is guaranteed to not have
    active pages as page activation in shrink_page_list() disables lumpy
    reclaim. Remove the dead code.

    Signed-off-by: KOSAKI Motohiro
    Signed-off-by: Mel Gorman
    Reviewed-by: Minchan Kim
    Cc: Johannes Weiner
    Cc: Wu Fengguang
    Cc: Rik van Riel
    Cc: KAMEZAWA Hiroyuki
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    KOSAKI Motohiro
     
  • shrink_page_list() can decide to give up reclaiming a page under a
    number of conditions such as

    1. trylock_page() failure
    2. page is unevictable
    3. zone reclaim and page is mapped
    4. PageWriteback() is true
    5. page is swapbacked and swap is full
    6. add_to_swap() failure
    7. page is dirty and gfpmask don't have GFP_IO, GFP_FS
    8. page is pinned
    9. IO queue is congested
    10. pageout() start IO, but not finished

    With lumpy reclaim, failures result in entering synchronous lumpy reclaim
    but this can be unnecessary. In cases (2), (3), (5), (6), (7) and (8),
    there is no point retrying. This patch causes lumpy reclaim to abort when
    it is known it will fail.

    Case (9) is more interesting. current behavior is,
    1. start shrink_page_list(async)
    2. found queue_congested()
    3. skip pageout write
    4. still start shrink_page_list(sync)
    5. wait on a lot of pages
    6. again, found queue_congested()
    7. give up pageout write again

    So, it's useless time wasting. However, just skipping page reclaim is
    also notgood as x86 allocating a huge page needs 512 pages for example.
    It can have more dirty pages than queue congestion threshold (~=128).

    After this patch, pageout() behaves as follows;

    - If order > PAGE_ALLOC_COSTLY_ORDER
    Ignore queue congestion always.
    - If order
    Signed-off-by: Mel Gorman
    Reviewed-by: KAMEZAWA Hiroyuki
    Cc: Johannes Weiner
    Cc: Minchan Kim
    Cc: Wu Fengguang
    Cc: Rik van Riel
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    KOSAKI Motohiro
     
  • congestion_wait() means "wait until queue congestion is cleared".
    However, synchronous lumpy reclaim does not need this congestion_wait() as
    shrink_page_list(PAGEOUT_IO_SYNC) uses wait_on_page_writeback() and it
    provides the necessary waiting.

    Signed-off-by: KOSAKI Motohiro
    Signed-off-by: Mel Gorman
    Reviewed-by: Minchan Kim
    Reviewed-by: Johannes Weiner
    Reviewed-by: Wu Fengguang
    Reviewed-by: KAMEZAWA Hiroyuki
    Cc: Rik van Riel
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    KOSAKI Motohiro
     
  • There have been numerous reports of stalls that pointed at the problem
    being somewhere in the VM. There are multiple roots to the problems which
    means dealing with any of the root problems in isolation is tricky to
    justify on their own and they would still need integration testing. This
    patch series puts together two different patch sets which in combination
    should tackle some of the root causes of latency problems being reported.

    Patch 1 adds a tracepoint for shrink_inactive_list. For this series, the
    most important results is being able to calculate the scanning/reclaim
    ratio as a measure of the amount of work being done by page reclaim.

    Patch 2 accounts for time spent in congestion_wait.

    Patches 3-6 were originally developed by Kosaki Motohiro but reworked for
    this series. It has been noted that lumpy reclaim is far too aggressive
    and trashes the system somewhat. As SLUB uses high-order allocations, a
    large cost incurred by lumpy reclaim will be noticeable. It was also
    reported during transparent hugepage support testing that lumpy reclaim
    was trashing the system and these patches should mitigate that problem
    without disabling lumpy reclaim.

    Patch 7 adds wait_iff_congested() and replaces some callers of
    congestion_wait(). wait_iff_congested() only sleeps if there is a BDI
    that is currently congested. Patch 8 notes that any BDI being congested
    is not necessarily a problem because there could be multiple BDIs of
    varying speeds and numberous zones. It attempts to track when a zone
    being reclaimed contains many pages backed by a congested BDI and if so,
    reclaimers wait on the congestion queue.

    I ran a number of tests with monitoring on X86, X86-64 and PPC64. Each
    machine had 3G of RAM and the CPUs were

    X86: Intel P4 2-core
    X86-64: AMD Phenom 4-core
    PPC64: PPC970MP

    Each used a single disk and the onboard IO controller. Dirty ratio was
    left at 20. I'm just going to report for X86-64 and PPC64 in a vague
    attempt to keep this report short. Four kernels were tested each based on
    v2.6.36-rc4

    traceonly-v2r2: Patches 1 and 2 to instrument vmscan reclaims and congestion_wait
    lowlumpy-v2r3: Patches 1-6 to test if lumpy reclaim is better
    waitcongest-v2r3: Patches 1-7 to only wait on congestion
    waitwriteback-v2r4: Patches 1-8 to detect when a zone is congested

    nocongest-v1r5: Patches 1-3 for testing wait_iff_congestion
    nodirect-v1r5: Patches 1-10 to disable filesystem writeback for better IO

    The tests run were as follows

    kernbench
    compile-based benchmark. Smoke test performance

    sysbench
    OLTP read-only benchmark. Will be re-run in the future as read-write

    micro-mapped-file-stream
    This is a micro-benchmark from Johannes Weiner that accesses a
    large sparse-file through mmap(). It was configured to run in only
    single-CPU mode but can be indicative of how well page reclaim
    identifies suitable pages.

    stress-highalloc
    Tries to allocate huge pages under heavy load.

    kernbench, iozone and sysbench did not report any performance regression
    on any machine. sysbench did pressure the system lightly and there was
    reclaim activity but there were no difference of major interest between
    the kernels.

    X86-64 micro-mapped-file-stream

    traceonly-v2r2 lowlumpy-v2r3 waitcongest-v2r3 waitwriteback-v2r4
    pgalloc_dma 1639.00 ( 0.00%) 667.00 (-145.73%) 1167.00 ( -40.45%) 578.00 (-183.56%)
    pgalloc_dma32 2842410.00 ( 0.00%) 2842626.00 ( 0.01%) 2843043.00 ( 0.02%) 2843014.00 ( 0.02%)
    pgalloc_normal 0.00 ( 0.00%) 0.00 ( 0.00%) 0.00 ( 0.00%) 0.00 ( 0.00%)
    pgsteal_dma 729.00 ( 0.00%) 85.00 (-757.65%) 609.00 ( -19.70%) 125.00 (-483.20%)
    pgsteal_dma32 2338721.00 ( 0.00%) 2447354.00 ( 4.44%) 2429536.00 ( 3.74%) 2436772.00 ( 4.02%)
    pgsteal_normal 0.00 ( 0.00%) 0.00 ( 0.00%) 0.00 ( 0.00%) 0.00 ( 0.00%)
    pgscan_kswapd_dma 1469.00 ( 0.00%) 532.00 (-176.13%) 1078.00 ( -36.27%) 220.00 (-567.73%)
    pgscan_kswapd_dma32 4597713.00 ( 0.00%) 4503597.00 ( -2.09%) 4295673.00 ( -7.03%) 3891686.00 ( -18.14%)
    pgscan_kswapd_normal 0.00 ( 0.00%) 0.00 ( 0.00%) 0.00 ( 0.00%) 0.00 ( 0.00%)
    pgscan_direct_dma 71.00 ( 0.00%) 134.00 ( 47.01%) 243.00 ( 70.78%) 352.00 ( 79.83%)
    pgscan_direct_dma32 305820.00 ( 0.00%) 280204.00 ( -9.14%) 600518.00 ( 49.07%) 957485.00 ( 68.06%)
    pgscan_direct_normal 0.00 ( 0.00%) 0.00 ( 0.00%) 0.00 ( 0.00%) 0.00 ( 0.00%)
    pageoutrun 16296.00 ( 0.00%) 21254.00 ( 23.33%) 18447.00 ( 11.66%) 20067.00 ( 18.79%)
    allocstall 443.00 ( 0.00%) 273.00 ( -62.27%) 513.00 ( 13.65%) 1568.00 ( 71.75%)

    These are based on the raw figures taken from /proc/vmstat. It's a rough
    measure of reclaim activity. Note that allocstall counts are higher
    because we are entering direct reclaim more often as a result of not
    sleeping in congestion. In itself, it's not necessarily a bad thing.
    It's easier to get a view of what happened from the vmscan tracepoint
    report.

    FTrace Reclaim Statistics: vmscan

    traceonly-v2r2 lowlumpy-v2r3 waitcongest-v2r3 waitwriteback-v2r4
    Direct reclaims 443 273 513 1568
    Direct reclaim pages scanned 305968 280402 600825 957933
    Direct reclaim pages reclaimed 43503 19005 30327 117191
    Direct reclaim write file async I/O 0 0 0 0
    Direct reclaim write anon async I/O 0 3 4 12
    Direct reclaim write file sync I/O 0 0 0 0
    Direct reclaim write anon sync I/O 0 0 0 0
    Wake kswapd requests 187649 132338 191695 267701
    Kswapd wakeups 3 1 4 1
    Kswapd pages scanned 4599269 4454162 4296815 3891906
    Kswapd pages reclaimed 2295947 2428434 2399818 2319706
    Kswapd reclaim write file async I/O 1 0 1 1
    Kswapd reclaim write anon async I/O 59 187 41 222
    Kswapd reclaim write file sync I/O 0 0 0 0
    Kswapd reclaim write anon sync I/O 0 0 0 0
    Time stalled direct reclaim (seconds) 4.34 2.52 6.63 2.96
    Time kswapd awake (seconds) 11.15 10.25 11.01 10.19

    Total pages scanned 4905237 4734564 4897640 4849839
    Total pages reclaimed 2339450 2447439 2430145 2436897
    %age total pages scanned/reclaimed 47.69% 51.69% 49.62% 50.25%
    %age total pages scanned/written 0.00% 0.00% 0.00% 0.00%
    %age file pages scanned/written 0.00% 0.00% 0.00% 0.00%
    Percentage Time Spent Direct Reclaim 29.23% 19.02% 38.48% 20.25%
    Percentage Time kswapd Awake 78.58% 78.85% 76.83% 79.86%

    What is interesting here for nocongest in particular is that while direct
    reclaim scans more pages, the overall number of pages scanned remains the
    same and the ratio of pages scanned to pages reclaimed is more or less the
    same. In other words, while we are sleeping less, reclaim is not doing
    more work and as direct reclaim and kswapd is awake for less time, it
    would appear to be doing less work.

    FTrace Reclaim Statistics: congestion_wait
    Direct number congest waited 87 196 64 0
    Direct time congest waited 4604ms 4732ms 5420ms 0ms
    Direct full congest waited 72 145 53 0
    Direct number conditional waited 0 0 324 1315
    Direct time conditional waited 0ms 0ms 0ms 0ms
    Direct full conditional waited 0 0 0 0
    KSwapd number congest waited 20 10 15 7
    KSwapd time congest waited 1264ms 536ms 884ms 284ms
    KSwapd full congest waited 10 4 6 2
    KSwapd number conditional waited 0 0 0 0
    KSwapd time conditional waited 0ms 0ms 0ms 0ms
    KSwapd full conditional waited 0 0 0 0

    The vanilla kernel spent 8 seconds asleep in direct reclaim and no time at
    all asleep with the patches.

    MMTests Statistics: duration
    User/Sys Time Running Test (seconds) 10.51 10.73 10.6 11.66
    Total Elapsed Time (seconds) 14.19 13.00 14.33 12.76

    Overall, the tests completed faster. It is interesting to note that backing off further
    when a zone is congested and not just a BDI was more efficient overall.

    PPC64 micro-mapped-file-stream
    pgalloc_dma 3024660.00 ( 0.00%) 3027185.00 ( 0.08%) 3025845.00 ( 0.04%) 3026281.00 ( 0.05%)
    pgalloc_normal 0.00 ( 0.00%) 0.00 ( 0.00%) 0.00 ( 0.00%) 0.00 ( 0.00%)
    pgsteal_dma 2508073.00 ( 0.00%) 2565351.00 ( 2.23%) 2463577.00 ( -1.81%) 2532263.00 ( 0.96%)
    pgsteal_normal 0.00 ( 0.00%) 0.00 ( 0.00%) 0.00 ( 0.00%) 0.00 ( 0.00%)
    pgscan_kswapd_dma 4601307.00 ( 0.00%) 4128076.00 ( -11.46%) 3912317.00 ( -17.61%) 3377165.00 ( -36.25%)
    pgscan_kswapd_normal 0.00 ( 0.00%) 0.00 ( 0.00%) 0.00 ( 0.00%) 0.00 ( 0.00%)
    pgscan_direct_dma 629825.00 ( 0.00%) 971622.00 ( 35.18%) 1063938.00 ( 40.80%) 1711935.00 ( 63.21%)
    pgscan_direct_normal 0.00 ( 0.00%) 0.00 ( 0.00%) 0.00 ( 0.00%) 0.00 ( 0.00%)
    pageoutrun 27776.00 ( 0.00%) 20458.00 ( -35.77%) 18763.00 ( -48.04%) 18157.00 ( -52.98%)
    allocstall 977.00 ( 0.00%) 2751.00 ( 64.49%) 2098.00 ( 53.43%) 5136.00 ( 80.98%)

    Similar trends to x86-64. allocstalls are up but it's not necessarily bad.

    FTrace Reclaim Statistics: vmscan
    Direct reclaims 977 2709 2098 5136
    Direct reclaim pages scanned 629825 963814 1063938 1711935
    Direct reclaim pages reclaimed 75550 242538 150904 387647
    Direct reclaim write file async I/O 0 0 0 2
    Direct reclaim write anon async I/O 0 10 0 4
    Direct reclaim write file sync I/O 0 0 0 0
    Direct reclaim write anon sync I/O 0 0 0 0
    Wake kswapd requests 392119 1201712 571935 571921
    Kswapd wakeups 3 2 3 3
    Kswapd pages scanned 4601307 4128076 3912317 3377165
    Kswapd pages reclaimed 2432523 2318797 2312673 2144616
    Kswapd reclaim write file async I/O 20 1 1 1
    Kswapd reclaim write anon async I/O 57 132 11 121
    Kswapd reclaim write file sync I/O 0 0 0 0
    Kswapd reclaim write anon sync I/O 0 0 0 0
    Time stalled direct reclaim (seconds) 6.19 7.30 13.04 10.88
    Time kswapd awake (seconds) 21.73 26.51 25.55 23.90

    Total pages scanned 5231132 5091890 4976255 5089100
    Total pages reclaimed 2508073 2561335 2463577 2532263
    %age total pages scanned/reclaimed 47.95% 50.30% 49.51% 49.76%
    %age total pages scanned/written 0.00% 0.00% 0.00% 0.00%
    %age file pages scanned/written 0.00% 0.00% 0.00% 0.00%
    Percentage Time Spent Direct Reclaim 18.89% 20.65% 32.65% 27.65%
    Percentage Time kswapd Awake 72.39% 80.68% 78.21% 77.40%

    Again, a similar trend that the congestion_wait changes mean that direct
    reclaim scans more pages but the overall number of pages scanned while
    slightly reduced, are very similar. The ratio of scanning/reclaimed
    remains roughly similar. The downside is that kswapd and direct reclaim
    was awake longer and for a larger percentage of the overall workload.
    It's possible there were big differences in the amount of time spent
    reclaiming slab pages between the different kernels which is plausible
    considering that the micro tests runs after fsmark and sysbench.

    Trace Reclaim Statistics: congestion_wait
    Direct number congest waited 845 1312 104 0
    Direct time congest waited 19416ms 26560ms 7544ms 0ms
    Direct full congest waited 745 1105 72 0
    Direct number conditional waited 0 0 1322 2935
    Direct time conditional waited 0ms 0ms 12ms 312ms
    Direct full conditional waited 0 0 0 3
    KSwapd number congest waited 39 102 75 63
    KSwapd time congest waited 2484ms 6760ms 5756ms 3716ms
    KSwapd full congest waited 20 48 46 25
    KSwapd number conditional waited 0 0 0 0
    KSwapd time conditional waited 0ms 0ms 0ms 0ms
    KSwapd full conditional waited 0 0 0 0

    The vanilla kernel spent 20 seconds asleep in direct reclaim and only
    312ms asleep with the patches. The time kswapd spent congest waited was
    also reduced by a large factor.

    MMTests Statistics: duration
    ser/Sys Time Running Test (seconds) 26.58 28.05 26.9 28.47
    Total Elapsed Time (seconds) 30.02 32.86 32.67 30.88

    With all patches applies, the completion times are very similar.

    X86-64 STRESS-HIGHALLOC
    traceonly-v2r2 lowlumpy-v2r3 waitcongest-v2r3waitwriteback-v2r4
    Pass 1 82.00 ( 0.00%) 84.00 ( 2.00%) 85.00 ( 3.00%) 85.00 ( 3.00%)
    Pass 2 90.00 ( 0.00%) 87.00 (-3.00%) 88.00 (-2.00%) 89.00 (-1.00%)
    At Rest 92.00 ( 0.00%) 90.00 (-2.00%) 90.00 (-2.00%) 91.00 (-1.00%)

    Success figures across the board are broadly similar.

    traceonly-v2r2 lowlumpy-v2r3 waitcongest-v2r3waitwriteback-v2r4
    Direct reclaims 1045 944 886 887
    Direct reclaim pages scanned 135091 119604 109382 101019
    Direct reclaim pages reclaimed 88599 47535 47863 46671
    Direct reclaim write file async I/O 494 283 465 280
    Direct reclaim write anon async I/O 29357 13710 16656 13462
    Direct reclaim write file sync I/O 154 2 2 3
    Direct reclaim write anon sync I/O 14594 571 509 561
    Wake kswapd requests 7491 933 872 892
    Kswapd wakeups 814 778 731 780
    Kswapd pages scanned 7290822 15341158 11916436 13703442
    Kswapd pages reclaimed 3587336 3142496 3094392 3187151
    Kswapd reclaim write file async I/O 91975 32317 28022 29628
    Kswapd reclaim write anon async I/O 1992022 789307 829745 849769
    Kswapd reclaim write file sync I/O 0 0 0 0
    Kswapd reclaim write anon sync I/O 0 0 0 0
    Time stalled direct reclaim (seconds) 4588.93 2467.16 2495.41 2547.07
    Time kswapd awake (seconds) 2497.66 1020.16 1098.06 1176.82

    Total pages scanned 7425913 15460762 12025818 13804461
    Total pages reclaimed 3675935 3190031 3142255 3233822
    %age total pages scanned/reclaimed 49.50% 20.63% 26.13% 23.43%
    %age total pages scanned/written 28.66% 5.41% 7.28% 6.47%
    %age file pages scanned/written 1.25% 0.21% 0.24% 0.22%
    Percentage Time Spent Direct Reclaim 57.33% 42.15% 42.41% 42.99%
    Percentage Time kswapd Awake 43.56% 27.87% 29.76% 31.25%

    Scanned/reclaimed ratios again look good with big improvements in
    efficiency. The Scanned/written ratios also look much improved. With a
    better scanned/written ration, there is an expectation that IO would be
    more efficient and indeed, the time spent in direct reclaim is much
    reduced by the full series and kswapd spends a little less time awake.

    Overall, indications here are that allocations were happening much faster
    and this can be seen with a graph of the latency figures as the
    allocations were taking place
    http://www.csn.ul.ie/~mel/postings/vmscanreduce-20101509/highalloc-interlatency-hydra-mean.ps

    FTrace Reclaim Statistics: congestion_wait
    Direct number congest waited 1333 204 169 4
    Direct time congest waited 78896ms 8288ms 7260ms 200ms
    Direct full congest waited 756 92 69 2
    Direct number conditional waited 0 0 26 186
    Direct time conditional waited 0ms 0ms 0ms 2504ms
    Direct full conditional waited 0 0 0 25
    KSwapd number congest waited 4 395 227 282
    KSwapd time congest waited 384ms 25136ms 10508ms 18380ms
    KSwapd full congest waited 3 232 98 176
    KSwapd number conditional waited 0 0 0 0
    KSwapd time conditional waited 0ms 0ms 0ms 0ms
    KSwapd full conditional waited 0 0 0 0
    KSwapd full conditional waited 318 0 312 9

    Overall, the time spent speeping is reduced. kswapd is still hitting
    congestion_wait() but that is because there are callers remaining where it
    wasn't clear in advance if they should be changed to wait_iff_congested()
    or not. Overall the sleep imes are reduced though - from 79ish seconds to
    about 19.

    MMTests Statistics: duration
    User/Sys Time Running Test (seconds) 3415.43 3386.65 3388.39 3377.5
    Total Elapsed Time (seconds) 5733.48 3660.33 3689.41 3765.39

    With the full series, the time to complete the tests are reduced by 30%

    PPC64 STRESS-HIGHALLOC
    traceonly-v2r2 lowlumpy-v2r3 waitcongest-v2r3waitwriteback-v2r4
    Pass 1 17.00 ( 0.00%) 34.00 (17.00%) 38.00 (21.00%) 43.00 (26.00%)
    Pass 2 25.00 ( 0.00%) 37.00 (12.00%) 42.00 (17.00%) 46.00 (21.00%)
    At Rest 49.00 ( 0.00%) 43.00 (-6.00%) 45.00 (-4.00%) 51.00 ( 2.00%)

    Success rates there are *way* up particularly considering that the 16MB
    huge pages on PPC64 mean that it's always much harder to allocate them.

    FTrace Reclaim Statistics: vmscan
    stress-highalloc stress-highalloc stress-highalloc stress-highalloc
    traceonly-v2r2 lowlumpy-v2r3 waitcongest-v2r3waitwriteback-v2r4
    Direct reclaims 499 505 564 509
    Direct reclaim pages scanned 223478 41898 51818 45605
    Direct reclaim pages reclaimed 137730 21148 27161 23455
    Direct reclaim write file async I/O 399 136 162 136
    Direct reclaim write anon async I/O 46977 2865 4686 3998
    Direct reclaim write file sync I/O 29 0 1 3
    Direct reclaim write anon sync I/O 31023 159 237 239
    Wake kswapd requests 420 351 360 326
    Kswapd wakeups 185 294 249 277
    Kswapd pages scanned 15703488 16392500 17821724 17598737
    Kswapd pages reclaimed 5808466 2908858 3139386 3145435
    Kswapd reclaim write file async I/O 159938 18400 18717 13473
    Kswapd reclaim write anon async I/O 3467554 228957 322799 234278
    Kswapd reclaim write file sync I/O 0 0 0 0
    Kswapd reclaim write anon sync I/O 0 0 0 0
    Time stalled direct reclaim (seconds) 9665.35 1707.81 2374.32 1871.23
    Time kswapd awake (seconds) 9401.21 1367.86 1951.75 1328.88

    Total pages scanned 15926966 16434398 17873542 17644342
    Total pages reclaimed 5946196 2930006 3166547 3168890
    %age total pages scanned/reclaimed 37.33% 17.83% 17.72% 17.96%
    %age total pages scanned/written 23.27% 1.52% 1.94% 1.43%
    %age file pages scanned/written 1.01% 0.11% 0.11% 0.08%
    Percentage Time Spent Direct Reclaim 44.55% 35.10% 41.42% 36.91%
    Percentage Time kswapd Awake 86.71% 43.58% 52.67% 41.14%

    While the scanning rates are slightly up, the scanned/reclaimed and
    scanned/written figures are much improved. The time spent in direct
    reclaim and with kswapd are massively reduced, mostly by the lowlumpy
    patches.

    FTrace Reclaim Statistics: congestion_wait
    Direct number congest waited 725 303 126 3
    Direct time congest waited 45524ms 9180ms 5936ms 300ms
    Direct full congest waited 487 190 52 3
    Direct number conditional waited 0 0 200 301
    Direct time conditional waited 0ms 0ms 0ms 1904ms
    Direct full conditional waited 0 0 0 19
    KSwapd number congest waited 0 2 23 4
    KSwapd time congest waited 0ms 200ms 420ms 404ms
    KSwapd full congest waited 0 2 2 4
    KSwapd number conditional waited 0 0 0 0
    KSwapd time conditional waited 0ms 0ms 0ms 0ms
    KSwapd full conditional waited 0 0 0 0

    Not as dramatic a story here but the time spent asleep is reduced and we
    can still see what wait_iff_congested is going to sleep when necessary.

    MMTests Statistics: duration
    User/Sys Time Running Test (seconds) 12028.09 3157.17 3357.79 3199.16
    Total Elapsed Time (seconds) 10842.07 3138.72 3705.54 3229.85

    The time to complete this test goes way down. With the full series, we
    are allocating over twice the number of huge pages in 30% of the time and
    there is a corresponding impact on the allocation latency graph available
    at.

    http://www.csn.ul.ie/~mel/postings/vmscanreduce-20101509/highalloc-interlatency-powyah-mean.ps

    This patch:

    Add a trace event for shrink_inactive_list() and updates the sample
    postprocessing script appropriately. It can be used to determine how many
    pages were reclaimed and for non-lumpy reclaim where exactly the pages
    were reclaimed from.

    Signed-off-by: Mel Gorman
    Cc: Johannes Weiner
    Cc: Minchan Kim
    Cc: Wu Fengguang
    Cc: KAMEZAWA Hiroyuki
    Cc: KOSAKI Motohiro
    Cc: Rik van Riel
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Mel Gorman
     
  • `priority' cannot be negative here. And the comment is obsolete.

    Signed-off-by: Shaohua Li
    Reviewed-by: KOSAKI Motohiro
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Shaohua Li
     
  • Ying Han reported that backing aging of anon pages in no swap system
    causes unnecessary TLB flush.

    When I sent a patch(69c8548175), I wanted this patch but Rik pointed out
    and allowed aging of anon pages to give a chance to promote from inactive
    to active LRU.

    It has a two problem.

    1) non-swap system

    Never make sense to age anon pages.

    2) swap configured but still doesn't swapon

    It doesn't make sense to age anon pages until swap-on time. But it's
    arguable. If we have aged anon pages by swapon, VM have moved anon pages
    from active to inactive. And in the time swapon by admin, the VM can't
    reclaim hot pages so we can protect hot pages swapout.

    But let's think about it. When does swap-on happen? It depends on admin.
    we can't expect it. Nonetheless, we have done aging of anon pages to
    protect hot pages swapout. It means we lost run time overhead when below
    high watermark but gain hot page swap-[in/out] overhead when VM decide
    swapout. Is it true? Let's think more detail. We don't promote anon
    pages in case of non-swap system. So even though VM does aging of anon
    pages, the pages would be in inactive LRU for a long time. It means many
    of pages in there would mark access bit again. So access bit hot/code
    separation would be pointless.

    This patch prevents unnecessary anon pages demotion in not-yet-swapon and
    non-configured swap system. Even, in non-configuared swap system
    inactive_anon_is_low can be compiled out.

    It could make side effect that hot anon pages could swap out when admin
    does swap on. But I think sooner or later it would be steady state. So
    it's not a big problem.

    We could lose someting but gain more thing(TLB flush and unnecessary
    function call to demote anon pages).

    Signed-off-by: Ying Han
    Signed-off-by: Minchan Kim
    Reviewed-by: Rik van Riel
    Reviewed-by: KOSAKI Motohiro
    Cc: Johannes Weiner
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Minchan Kim
     
  • Non-NUMA systems do never create these files anyway, since they are only
    created by driver subsystem when NUMA is configured.

    [akpm@linux-foundation.org: cleanup]
    Signed-off-by: Thadeu Lima de Souza Cascardo
    Reviewed-by: KOSAKI Motohiro
    Cc: Lee Schermerhorn
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Thadeu Lima de Souza Cascardo
     
  • This removes more dead code that was somehow missed by commit 0d99519efef
    (writeback: remove unused nonblocking and congestion checks). There are
    no behavior change except for the removal of two entries from one of the
    ext4 tracing interface.

    The nonblocking checks in ->writepages are no longer used because the
    flusher now prefer to block on get_request_wait() than to skip inodes on
    IO congestion. The latter will lead to more seeky IO.

    The nonblocking checks in ->writepage are no longer used because it's
    redundant with the WB_SYNC_NONE check.

    We no long set ->nonblocking in VM page out and page migration, because
    a) it's effectively redundant with WB_SYNC_NONE in current code
    b) it's old semantic of "Don't get stuck on request queues" is mis-behavior:
    that would skip some dirty inodes on congestion and page out others, which
    is unfair in terms of LRU age.

    Inspired by Christoph Hellwig. Thanks!

    Signed-off-by: Wu Fengguang
    Cc: Theodore Ts'o
    Cc: David Howells
    Cc: Sage Weil
    Cc: Steve French
    Cc: Chris Mason
    Cc: Jens Axboe
    Cc: Christoph Hellwig
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Wu Fengguang
     

25 Oct, 2010

1 commit

  • * 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial: (39 commits)
    Update broken web addresses in arch directory.
    Update broken web addresses in the kernel.
    Revert "drivers/usb: Remove unnecessary return's from void functions" for musb gadget
    Revert "Fix typo: configuation => configuration" partially
    ida: document IDA_BITMAP_LONGS calculation
    ext2: fix a typo on comment in ext2/inode.c
    drivers/scsi: Remove unnecessary casts of private_data
    drivers/s390: Remove unnecessary casts of private_data
    net/sunrpc/rpc_pipe.c: Remove unnecessary casts of private_data
    drivers/infiniband: Remove unnecessary casts of private_data
    drivers/gpu/drm: Remove unnecessary casts of private_data
    kernel/pm_qos_params.c: Remove unnecessary casts of private_data
    fs/ecryptfs: Remove unnecessary casts of private_data
    fs/seq_file.c: Remove unnecessary casts of private_data
    arm: uengine.c: remove C99 comments
    arm: scoop.c: remove C99 comments
    Fix typo configue => configure in comments
    Fix typo: configuation => configuration
    Fix typo interrest[ing|ed] => interest[ing|ed]
    Fix various typos of valid in comments
    ...

    Fix up trivial conflicts in:
    drivers/char/ipmi/ipmi_si_intf.c
    drivers/usb/gadget/rndis.c
    net/irda/irnet/irnet_ppp.c

    Linus Torvalds
     

23 Sep, 2010

1 commit

  • M. Vefa Bicakci reported 2.6.35 kernel hang up when hibernation on his
    32bit 3GB mem machine.
    (https://bugzilla.kernel.org/show_bug.cgi?id=16771). Also he bisected
    the regression to

    commit bb21c7ce18eff8e6e7877ca1d06c6db719376e3c
    Author: KOSAKI Motohiro
    Date: Fri Jun 4 14:15:05 2010 -0700

    vmscan: fix do_try_to_free_pages() return value when priority==0 reclaim failure

    At first impression, this seemed very strange because the above commit
    only chenged function return value and hibernate_preallocate_memory()
    ignore return value of shrink_all_memory(). But it's related.

    Now, page allocation from hibernation code may enter infinite loop if the
    system has highmem. The reasons are that vmscan don't care enough OOM
    case when oom_killer_disabled.

    The problem sequence is following as.

    1. hibernation
    2. oom_disable
    3. alloc_pages
    4. do_try_to_free_pages
    if (scanning_global_lru(sc) && !all_unreclaimable)
    return 1;

    If kswapd is not freozen, it would set zone->all_unreclaimable to 1 and
    then shrink_zones maybe return true(ie, all_unreclaimable is true). So at
    last, alloc_pages could go to _nopage_. If it is, it should have no
    problem.

    This patch adds all_unreclaimable check to protect in direct reclaim path,
    too. It can care of hibernation OOM case and help bailout
    all_unreclaimable case slightly.

    Signed-off-by: KOSAKI Motohiro
    Signed-off-by: Minchan Kim
    Reported-by: M. Vefa Bicakci
    Reported-by:
    Reviewed-by: Johannes Weiner
    Tested-by:
    Acked-by: Rafael J. Wysocki
    Acked-by: Rik van Riel
    Acked-by: KAMEZAWA Hiroyuki
    Cc: Balbir Singh
    Cc:
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Minchan Kim
     

18 Aug, 2010

1 commit


11 Aug, 2010

4 commits


10 Aug, 2010

16 commits

  • Fix "system goes unresponsive under memory pressure and lots of
    dirty/writeback pages" bug.

    http://lkml.org/lkml/2010/4/4/86

    In the above thread, Andreas Mohr described that

    Invoking any command locked up for minutes (note that I'm
    talking about attempted additional I/O to the _other_,
    _unaffected_ main system HDD - such as loading some shell
    binaries -, NOT the external SSD18M!!).

    This happens when the two conditions are both meet:
    - under memory pressure
    - writing heavily to a slow device

    OOM also happens in Andreas' system. The OOM trace shows that 3 processes
    are stuck in wait_on_page_writeback() in the direct reclaim path. One in
    do_fork() and the other two in unix_stream_sendmsg(). They are blocked on
    this condition:

    (sc->order && priority < DEF_PRIORITY - 2)

    which was introduced in commit 78dc583d (vmscan: low order lumpy reclaim
    also should use PAGEOUT_IO_SYNC) one year ago. That condition may be too
    permissive. In Andreas' case, 512MB/1024 = 512KB. If the direct reclaim
    for the order-1 fork() allocation runs into a range of 512KB
    hard-to-reclaim LRU pages, it will be stalled.

    It's a severe problem in three ways.

    Firstly, it can easily happen in daily desktop usage. vmscan priority can
    easily go below (DEF_PRIORITY - 2) on _local_ memory pressure. Even if
    the system has 50% globally reclaimable pages, it still has good
    opportunity to have 0.1% sized hard-to-reclaim ranges. For example, a
    simple dd can easily create a big range (up to 20%) of dirty pages in the
    LRU lists. And order-1 to order-3 allocations are more than common with
    SLUB. Try "grep -v '1 :' /proc/slabinfo" to get the list of high order
    slab caches. For example, the order-1 radix_tree_node slab cache may
    stall applications at swap-in time; the order-3 inode cache on most
    filesystems may stall applications when trying to read some file; the
    order-2 proc_inode_cache may stall applications when trying to open a
    /proc file.

    Secondly, once triggered, it will stall unrelated processes (not doing IO
    at all) in the system. This "one slow USB device stalls the whole system"
    avalanching effect is very bad.

    Thirdly, once stalled, the stall time could be intolerable long for the
    users. When there are 20MB queued writeback pages and USB 1.1 is writing
    them in 1MB/s, wait_on_page_writeback() will stuck for up to 20 seconds.
    Not to mention it may be called multiple times.

    So raise the bar to only enable PAGEOUT_IO_SYNC when priority goes below
    DEF_PRIORITY/3, or 6.25% LRU size. As the default dirty throttle ratio is
    20%, it will hardly be triggered by pure dirty pages. We'd better treat
    PAGEOUT_IO_SYNC as some last resort workaround -- its stall time is so
    uncomfortably long (easily goes beyond 1s).

    The bar is only raised for (order < PAGE_ALLOC_COSTLY_ORDER) allocations,
    which are easy to satisfy in 1TB memory boxes. So, although 6.25% of
    memory could be an awful lot of pages to scan on a system with 1TB of
    memory, it won't really have to busy scan that much.

    Andreas tested an older version of this patch and reported that it mostly
    fixed his problem. Mel Gorman helped improve it and KOSAKI Motohiro will
    fix it further in the next patch.

    Reported-by: Andreas Mohr
    Reviewed-by: Minchan Kim
    Reviewed-by: KOSAKI Motohiro
    Signed-off-by: Mel Gorman
    Signed-off-by: Wu Fengguang
    Cc: Rik van Riel
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Wu Fengguang
     
  • Memcg also need to trace reclaim progress as direct reclaim. This patch
    add it.

    Signed-off-by: KOSAKI Motohiro
    Reviewed-by: KAMEZAWA Hiroyuki
    Acked-by: Mel Gorman
    Acked-by: Balbir Singh
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    KOSAKI Motohiro
     
  • Presently shrink_slab() has the following scanning equation.

    lru_scanned max_pass
    basic_scan_objects = 4 x ------------- x -----------------------------
    lru_pages shrinker->seeks (default:2)

    scan_objects = min(basic_scan_objects, max_pass * 2)

    If we pass very small value as lru_pages instead real number of lru pages,
    shrink_slab() drop much objects rather than necessary. And now,
    __zone_reclaim() pass 'order' as lru_pages by mistake. That produces a
    bad result.

    For example, if we receive very low memory pressure (scan = 32, order =
    0), shrink_slab() via zone_reclaim() always drop _all_ icache/dcache
    objects. (see above equation, very small lru_pages make very big
    scan_objects result).

    This patch fixes it.

    [akpm@linux-foundation.org: fix layout, typos]
    Signed-off-by: KOSAKI Motohiro
    Reviewed-by: Minchan Kim
    Acked-by: Christoph Lameter
    Acked-by: Rik van Riel
    Cc: Johannes Weiner
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    KOSAKI Motohiro
     
  • Rik van Riel pointed out reading reclaim_stat should be protected
    lru_lock, otherwise vmscan might sweep 2x much pages.

    This fault was introduced by

    commit 4f98a2fee8acdb4ac84545df98cccecfd130f8db
    Author: Rik van Riel
    Date: Sat Oct 18 20:26:32 2008 -0700

    vmscan: split LRU lists into anon & file sets

    Signed-off-by: KOSAKI Motohiro
    Cc: Rik van Riel
    Reviewed-by: Minchan Kim
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    KOSAKI Motohiro
     
  • 'slab_reclaimable' and 'nr_pages' are unsigned. Subtraction is unsafe
    because negative results would be misinterpreted.

    Signed-off-by: KOSAKI Motohiro
    Reviewed-by: Minchan Kim
    Cc: Mel Gorman
    Cc: Rik van Riel
    Cc: Johannes Weiner
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    KOSAKI Motohiro
     
  • When shrink_inactive_list() isolates pages, it updates a number of
    counters using temporary variables to gather them. These consume stack
    and it's in the main path that calls ->writepage(). This patch moves the
    accounting updates outside of the main path to reduce stack usage.

    Signed-off-by: Mel Gorman
    Reviewed-by: Johannes Weiner
    Acked-by: Rik van Riel
    Cc: Dave Chinner
    Cc: Chris Mason
    Cc: Nick Piggin
    Cc: Rik van Riel
    Cc: Johannes Weiner
    Cc: Christoph Hellwig
    Cc: KAMEZAWA Hiroyuki
    Cc: KOSAKI Motohiro
    Cc: Andrea Arcangeli
    Cc: Michael Rubin
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Mel Gorman
     
  • shrink_page_list() sets up a pagevec to release pages as according as they
    are free. It uses significant amounts of stack on the pagevec. This
    patch adds pages to be freed via pagevec to a linked list which is then
    freed en-masse at the end. This avoids using stack in the main path that
    potentially calls writepage().

    Signed-off-by: Mel Gorman
    Reviewed-by: Rik van Riel
    Cc: Dave Chinner
    Cc: Chris Mason
    Cc: Nick Piggin
    Cc: Rik van Riel
    Cc: Johannes Weiner
    Cc: Christoph Hellwig
    Cc: KAMEZAWA Hiroyuki
    Cc: KOSAKI Motohiro
    Cc: Andrea Arcangeli
    Cc: Michael Rubin
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Mel Gorman
     
  • shrink_inactive_list() sets up a pagevec to release unfreeable pages. It
    uses significant amounts of stack doing this. This patch splits
    shrink_inactive_list() to take the stack usage out of the main path so
    that callers to writepage() do not contain an unused pagevec on the stack.

    Signed-off-by: Mel Gorman
    Reviewed-by: Johannes Weiner
    Acked-by: Rik van Riel
    Cc: Dave Chinner
    Cc: Chris Mason
    Cc: Nick Piggin
    Cc: Rik van Riel
    Cc: Johannes Weiner
    Cc: Christoph Hellwig
    Cc: KAMEZAWA Hiroyuki
    Cc: KOSAKI Motohiro
    Cc: Andrea Arcangeli
    Cc: Michael Rubin
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Mel Gorman
     
  • Remove temporary variable that is only used once and does not help clarify
    code.

    [akpm@linux-foundation.org: coding-style fixes]
    Signed-off-by: Mel Gorman
    Reviewed-by: Rik van Riel
    Cc: Dave Chinner
    Cc: Chris Mason
    Cc: Nick Piggin
    Cc: Rik van Riel
    Cc: Johannes Weiner
    Cc: Christoph Hellwig
    Cc: KAMEZAWA Hiroyuki
    Cc: KOSAKI Motohiro
    Cc: Andrea Arcangeli
    Cc: Michael Rubin
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Mel Gorman
     
  • Now, max_scan of shrink_inactive_list() is always passed less than
    SWAP_CLUSTER_MAX. then, we can remove scanning pages loop in it. This
    patch also help stack diet.

    detail
    - remove "while (nr_scanned < max_scan)" loop
    - remove nr_freed (now, we use nr_reclaimed directly)
    - remove nr_scan (now, we use nr_scanned directly)
    - rename max_scan to nr_to_scan
    - pass nr_to_scan into isolate_pages() directly instead
    using SWAP_CLUSTER_MAX

    [akpm@linux-foundation.org: coding-style fixes]
    Signed-off-by: KOSAKI Motohiro
    Signed-off-by: Mel Gorman
    Reviewed-by: Johannes Weiner
    Reviewed-by: Rik van Riel
    Cc: Dave Chinner
    Cc: Chris Mason
    Cc: Nick Piggin
    Cc: Rik van Riel
    Cc: Johannes Weiner
    Cc: Christoph Hellwig
    Cc: KAMEZAWA Hiroyuki
    Cc: KOSAKI Motohiro
    Cc: Andrea Arcangeli
    Cc: Michael Rubin
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    KOSAKI Motohiro
     
  • Since 2.6.28 zone->prev_priority is unused. Then it can be removed
    safely. It reduce stack usage slightly.

    Now I have to say that I'm sorry. 2 years ago, I thought prev_priority
    can be integrate again, it's useful. but four (or more) times trying
    haven't got good performance number. Thus I give up such approach.

    The rest of this changelog is notes on prev_priority and why it existed in
    the first place and why it might be not necessary any more. This information
    is based heavily on discussions between Andrew Morton, Rik van Riel and
    Kosaki Motohiro who is heavily quotes from.

    Historically prev_priority was important because it determined when the VM
    would start unmapping PTE pages. i.e. there are no balances of note within
    the VM, Anon vs File and Mapped vs Unmapped. Without prev_priority, there
    is a potential risk of unnecessarily increasing minor faults as a large
    amount of read activity of use-once pages could push mapped pages to the
    end of the LRU and get unmapped.

    There is no proof this is still a problem but currently it is not considered
    to be. Active files are not deactivated if the active file list is smaller
    than the inactive list reducing the liklihood that file-mapped pages are
    being pushed off the LRU and referenced executable pages are kept on the
    active list to avoid them getting pushed out by read activity.

    Even if it is a problem, prev_priority prev_priority wouldn't works
    nowadays. First of all, current vmscan still a lot of UP centric code. it
    expose some weakness on some dozens CPUs machine. I think we need more and
    more improvement.

    The problem is, current vmscan mix up per-system-pressure, per-zone-pressure
    and per-task-pressure a bit. example, prev_priority try to boost priority to
    other concurrent priority. but if the another task have mempolicy restriction,
    it is unnecessary, but also makes wrong big latency and exceeding reclaim.
    per-task based priority + prev_priority adjustment make the emulation of
    per-system pressure. but it have two issue 1) too rough and brutal emulation
    2) we need per-zone pressure, not per-system.

    Another example, currently DEF_PRIORITY is 12. it mean the lru rotate about
    2 cycle (1/4096 + 1/2048 + 1/1024 + .. + 1) before invoking OOM-Killer.
    but if 10,0000 thrreads enter DEF_PRIORITY reclaim at the same time, the
    system have higher memory pressure than priority==0 (1/4096*10,000 > 2).
    prev_priority can't solve such multithreads workload issue. In other word,
    prev_priority concept assume the sysmtem don't have lots threads."

    Signed-off-by: KOSAKI Motohiro
    Signed-off-by: Mel Gorman
    Reviewed-by: Johannes Weiner
    Reviewed-by: Rik van Riel
    Cc: Dave Chinner
    Cc: Chris Mason
    Cc: Nick Piggin
    Cc: Rik van Riel
    Cc: Johannes Weiner
    Cc: Christoph Hellwig
    Cc: KAMEZAWA Hiroyuki
    Cc: KOSAKI Motohiro
    Cc: Andrea Arcangeli
    Cc: Michael Rubin
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    KOSAKI Motohiro
     
  • Add a trace event for when page reclaim queues a page for IO and records
    whether it is synchronous or asynchronous. Excessive synchronous IO for a
    process can result in noticeable stalls during direct reclaim. Excessive
    IO from page reclaim may indicate that the system is seriously under
    provisioned for the amount of dirty pages that exist.

    Signed-off-by: Mel Gorman
    Acked-by: Rik van Riel
    Acked-by: Larry Woodman
    Cc: Dave Chinner
    Cc: Chris Mason
    Cc: Nick Piggin
    Cc: Rik van Riel
    Cc: Johannes Weiner
    Cc: Christoph Hellwig
    Cc: KAMEZAWA Hiroyuki
    Cc: KOSAKI Motohiro
    Cc: Andrea Arcangeli
    Cc: Michael Rubin
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Mel Gorman
     
  • Add an event for when pages are isolated en-masse from the LRU lists.
    This event augments the information available on LRU traffic and can be
    used to evaluate lumpy reclaim.

    [akpm@linux-foundation.org: coding-style fixes]
    Signed-off-by: Mel Gorman
    Acked-by: Rik van Riel
    Acked-by: Larry Woodman
    Cc: Dave Chinner
    Cc: Chris Mason
    Cc: Nick Piggin
    Cc: Rik van Riel
    Cc: Johannes Weiner
    Cc: Christoph Hellwig
    Cc: KAMEZAWA Hiroyuki
    Cc: KOSAKI Motohiro
    Cc: Andrea Arcangeli
    Cc: Michael Rubin
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Mel Gorman
     
  • Add two trace events for kswapd waking up and going asleep for the
    purposes of tracking kswapd activity and two trace events for direct
    reclaim beginning and ending. The information can be used to work out how
    much time a process or the system is spending on the reclamation of pages
    and in the case of direct reclaim, how many pages were reclaimed for that
    process. High frequency triggering of these events could point to memory
    pressure problems.

    Signed-off-by: Mel Gorman
    Acked-by: Rik van Riel
    Acked-by: Larry Woodman
    Cc: Dave Chinner
    Cc: Chris Mason
    Cc: Nick Piggin
    Cc: Rik van Riel
    Cc: Johannes Weiner
    Cc: Christoph Hellwig
    Cc: KAMEZAWA Hiroyuki
    Cc: KOSAKI Motohiro
    Cc: Andrea Arcangeli
    Cc: Michael Rubin
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Mel Gorman
     
  • shrink_zones() need relatively long time and lru_pages can change
    dramatically during shrink_zones(). So lru_pages should be recalculated
    for each priority.

    Signed-off-by: KOSAKI Motohiro
    Acked-by: Rik van Riel
    Reviewed-by: Minchan Kim
    Acked-by: Johannes Weiner
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    KOSAKI Motohiro
     
  • Swap token don't works when zone reclaim is enabled since it was born.
    Because __zone_reclaim() always call disable_swap_token() unconditionally.

    This kill swap token feature completely. As far as I know, nobody want to
    that. Remove it.

    Signed-off-by: KOSAKI Motohiro
    Acked-by: Rik van Riel
    Reviewed-by: Minchan Kim
    Cc: Christoph Lameter
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    KOSAKI Motohiro
     

21 Jul, 2010

1 commit


19 Jul, 2010

1 commit

  • The current shrinker implementation requires the registered callback
    to have global state to work from. This makes it difficult to shrink
    caches that are not global (e.g. per-filesystem caches). Pass the shrinker
    structure to the callback so that users can embed the shrinker structure
    in the context the shrinker needs to operate on and get back to it in the
    callback via container_of().

    Signed-off-by: Dave Chinner
    Reviewed-by: Christoph Hellwig

    Dave Chinner
     

05 Jun, 2010

1 commit

  • Greg Thelen reported recent Johannes's stack diet patch makes kernel hang.
    His test is following.

    mount -t cgroup none /cgroups -o memory
    mkdir /cgroups/cg1
    echo $$ > /cgroups/cg1/tasks
    dd bs=1024 count=1024 if=/dev/null of=/data/foo
    echo $$ > /cgroups/tasks
    echo 1 > /cgroups/cg1/memory.force_empty

    Actually, This OOM hard to try logic have been corrupted since following
    two years old patch.

    commit a41f24ea9fd6169b147c53c2392e2887cc1d9247
    Author: Nishanth Aravamudan
    Date: Tue Apr 29 00:58:25 2008 -0700

    page allocator: smarter retry of costly-order allocations

    Original intention was "return success if the system have shrinkable zones
    though priority==0 reclaim was failure". But the above patch changed to
    "return nr_reclaimed if .....". Oh, That forgot nr_reclaimed may be 0 if
    priority==0 reclaim failure.

    And Johannes's patch 0aeb2339e54e ("vmscan: remove all_unreclaimable scan
    control") made it more corrupt. Originally, priority==0 reclaim failure
    on memcg return 0, but this patch changed to return 1. It totally
    confused memcg.

    This patch fixes it completely.

    Reported-by: Greg Thelen
    Signed-off-by: KOSAKI Motohiro
    Acked-by: Johannes Weiner
    Acked-by: KAMEZAWA Hiroyuki
    Tested-by: Greg Thelen
    Acked-by: Balbir Singh
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    KOSAKI Motohiro
     

25 May, 2010

3 commits

  • For now, we have global isolation vs. memory control group isolation, do
    not allow the reclaim entry function to set an arbitrary page isolation
    callback, we do not need that flexibility.

    And since we already pass around the group descriptor for the memory
    control group isolation case, just use it to decide which one of the two
    isolator functions to use.

    The decisions can be merged into nearby branches, so no extra cost there.
    In fact, we save the indirect calls.

    Signed-off-by: Johannes Weiner
    Cc: KOSAKI Motohiro
    Cc: Mel Gorman
    Cc: Rik van Riel
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Johannes Weiner
     
  • This scan control is abused to communicate a return value from
    shrink_zones(). Write this idiomatically and remove the knob.

    Signed-off-by: Johannes Weiner
    Reviewed-by: KOSAKI Motohiro
    Cc: Mel Gorman
    Cc: Rik van Riel
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Johannes Weiner
     
  • If vmscan is under lumpy reclaim mode, it have to ignore referenced bit
    for making contenious free pages. but current page_check_references()
    doesn't.

    Fix it.

    Signed-off-by: KOSAKI Motohiro
    Reviewed-by: Minchan Kim
    Cc: Rik van Riel
    Cc: Lee Schermerhorn
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    KOSAKI Motohiro