Move LRU page reclaim from zones to nodes v7
Subsystems (22)
cover Move LRU page reclaim from zones to nodes v7
The bulk of the updates are in response to review from Vlastimil Babka and received a lot more testing than v6.
Changelog since v6
o Correct reclaim_idx when direct reclaiming for memcg
o Also account LRU pages per zone for compaction/reclaim
o Add page_pgdat helper with more efficient lookup
o Init pgdat LRU lock only once
o Slight optimisation to wake_all_kswapds
o Always wake kcompactd when kswapd is going to sleep
o Rebase to mmotm as of June 15th, 2016
Changelog since v5
o Rebase and adjust to changes
Changelog since v4
o Rebase on top of v3 of page allocator optimisation series
Changelog since v3
o Rebase on top of the page allocator optimisation series
o Remove RFC tag
This is the latest version of a series that moves LRUs from the zones to the node that is based upon 4.6-rc3 plus the page allocator optimisation series. Conceptually, this is simple but there are a lot of details. Some of the broad motivations for this are;
1. The residency of a page partially depends on what zone the page was allocated from. This is partially combatted by the fair zone allocation policy but that is a partial solution that introduces overhead in the page allocator paths.
2. Currently, reclaim on node 0 behaves slightly different to node 1. For example, direct reclaim scans in zonelist order and reclaims even if the zone is over the high watermark regardless of the age of pages in that LRU. Kswapd on the other hand starts reclaim on the highest unbalanced zone. A difference in distribution of file/anon pages due to when they were allocated results can result in a difference in again. While the fair zone allocation policy mitigates some of the problems here, the page reclaim results on a multi-zone node will always be different to a single-zone node.
it was scheduled on as a result.
3. kswapd and the page allocator scan zones in the opposite order to avoid interfering with each other but it's sensitive to timing. This mitigates the page allocator using pages that were allocated very recently in the ideal case but it's sensitive to timing. When kswapd is allocating from lower zones then it's great but during the rebalancing of the highest zone, the page allocator and kswapd interfere with each other. It's worse if the highest zone is small and difficult to balance.
4. slab shrinkers are node-based which makes it harder to identify the exact relationship between slab reclaim and LRU reclaim.
The reason we have zone-based reclaim is that we used to have large highmem zones in common configurations and it was necessary to quickly find ZONE_NORMAL pages for reclaim. Today, this is much less of a concern as machines with lots of memory will (or should) use 64-bit kernels. Combinations of 32-bit hardware and 64-bit hardware are rare. Machines that do use highmem should have relatively low highmem:lowmem ratios than we worried about in the past.
Conceptually, moving to node LRUs should be easier to understand. The page allocator plays fewer tricks to game reclaim and reclaim behaves similarly on all nodes.
The series has been tested on a 16 core UMA machine and a 2-socket 48 core NUMA machine. The UMA results are presented in most cases as the NUMA machine behaved similarly.
pagealloc
---------
This is a microbenchmark that shows the benefit of removing the fair zone allocation policy. It was tested uip to order-4 but only orders 0 and 1 are shown as the other orders were comparable.
4.7.0-rc3 4.7.0-rc3
mmotm-20160615 nodelru-v7r17
Min total-odr0-1 485.00 ( 0.00%) 462.00 ( 4.74%)
Min total-odr0-2 354.00 ( 0.00%) 341.00 ( 3.67%)
Min total-odr0-4 285.00 ( 0.00%) 277.00 ( 2.81%)
Min total-odr0-8 249.00 ( 0.00%) 240.00 ( 3.61%)
Min total-odr0-16 230.00 ( 0.00%) 224.00 ( 2.61%)
Min total-odr0-32 222.00 ( 0.00%) 215.00 ( 3.15%)
Min total-odr0-64 216.00 ( 0.00%) 210.00 ( 2.78%)
Min total-odr0-128 214.00 ( 0.00%) 208.00 ( 2.80%)
Min total-odr0-256 248.00 ( 0.00%) 233.00 ( 6.05%)
Min total-odr0-512 277.00 ( 0.00%) 270.00 ( 2.53%)
Min total-odr0-1024 294.00 ( 0.00%) 284.00 ( 3.40%)
Min total-odr0-2048 308.00 ( 0.00%) 298.00 ( 3.25%)
Min total-odr0-4096 318.00 ( 0.00%) 307.00 ( 3.46%)
Min total-odr0-8192 322.00 ( 0.00%) 308.00 ( 4.35%)
Min total-odr0-16384 324.00 ( 0.00%) 309.00 ( 4.63%)
Min total-odr1-1 729.00 ( 0.00%) 686.00 ( 5.90%)
Min total-odr1-2 533.00 ( 0.00%) 520.00 ( 2.44%)
Min total-odr1-4 434.00 ( 0.00%) 415.00 ( 4.38%)
Min total-odr1-8 390.00 ( 0.00%) 364.00 ( 6.67%)
Min total-odr1-16 359.00 ( 0.00%) 335.00 ( 6.69%)
Min total-odr1-32 356.00 ( 0.00%) 327.00 ( 8.15%)
Min total-odr1-64 356.00 ( 0.00%) 321.00 ( 9.83%)
Min total-odr1-128 356.00 ( 0.00%) 333.00 ( 6.46%)
Min total-odr1-256 354.00 ( 0.00%) 337.00 ( 4.80%)
Min total-odr1-512 366.00 ( 0.00%) 340.00 ( 7.10%)
Min total-odr1-1024 373.00 ( 0.00%) 354.00 ( 5.09%)
Min total-odr1-2048 375.00 ( 0.00%) 354.00 ( 5.60%)
Min total-odr1-4096 374.00 ( 0.00%) 354.00 ( 5.35%)
Min total-odr1-8192 370.00 ( 0.00%) 355.00 ( 4.05%)This shows a steady improvement throughout. The primary benefit is from reduced system CPU usage which is obvious from the overall times;
4.7.0-rc3 4.7.0-rc3
mmotm-20160615 nodelru-v7
User 174.06 174.58
System 2656.78 2485.21
Elapsed 2885.07 2713.67The vmstats also showed that the fair zone allocation policy was definitely removed as can be seen here;
4.7.0-rc3 4.7.0-rc3
mmotm-20160615nodelru-v7r17DMA32 allocs 28794408561 0
Normal allocs 48431969998 77226313470
Movable allocs 0 0
tiobench on ext4
----------------
tiobench is a benchmark that artifically benefits if old pages remain resident while new pages get reclaimed. The fair zone allocation policy mitigates this problem so pages age fairly. While the benchmark has problems, it is important that tiobench performance remains constant as it implies that page aging problems that the fair zone allocation policy fixes are not re-introduced.
4.7.0-rc3 4.7.0-rc3
mmotm-20160615 nodelru-v7r17
Min PotentialReadSpeed 90.24 ( 0.00%) 90.14 ( -0.11%)
Min SeqRead-MB/sec-1 80.63 ( 0.00%) 83.09 ( 3.05%)
Min SeqRead-MB/sec-2 71.91 ( 0.00%) 72.44 ( 0.74%)
Min SeqRead-MB/sec-4 75.20 ( 0.00%) 74.32 ( -1.17%)
Min SeqRead-MB/sec-8 65.30 ( 0.00%) 65.21 ( -0.14%)
Min SeqRead-MB/sec-16 62.62 ( 0.00%) 62.12 ( -0.80%)
Min RandRead-MB/sec-1 0.90 ( 0.00%) 0.94 ( 4.44%)
Min RandRead-MB/sec-2 0.96 ( 0.00%) 0.97 ( 1.04%)
Min RandRead-MB/sec-4 1.43 ( 0.00%) 1.41 ( -1.40%)
Min RandRead-MB/sec-8 1.67 ( 0.00%) 1.72 ( 2.99%)
Min RandRead-MB/sec-16 1.77 ( 0.00%) 1.86 ( 5.08%)
Min SeqWrite-MB/sec-1 78.12 ( 0.00%) 79.78 ( 2.12%)
Min SeqWrite-MB/sec-2 72.74 ( 0.00%) 73.23 ( 0.67%)
Min SeqWrite-MB/sec-4 79.40 ( 0.00%) 78.32 ( -1.36%)
Min SeqWrite-MB/sec-8 73.18 ( 0.00%) 71.40 ( -2.43%)
Min SeqWrite-MB/sec-16 75.82 ( 0.00%) 75.24 ( -0.76%)
Min RandWrite-MB/sec-1 1.18 ( 0.00%) 1.15 ( -2.54%)
Min RandWrite-MB/sec-2 1.05 ( 0.00%) 0.99 ( -5.71%)
Min RandWrite-MB/sec-4 1.00 ( 0.00%) 0.96 ( -4.00%)
Min RandWrite-MB/sec-8 0.91 ( 0.00%) 0.92 ( 1.10%)
Min RandWrite-MB/sec-16 0.92 ( 0.00%) 0.92 ( 0.00%)This shows that the series has little or not impact on tiobench which is desirable. It indicates that the fair zone allocation policy was removed in a manner that didn't reintroduce one class of page aging bug. There were only minor differences in overall reclaim activity
4.7.0-rc3 4.7.0-rc3
mmotm-20160615nodelru-v7r17
Minor Faults 640992 640721
Major Faults 728 623
Swap Ins 0 0
Swap Outs 0 0
DMA allocs 0 0
DMA32 allocs 46174282 44219717
Normal allocs 77949344 79858024
Movable allocs 0 0
Allocation stalls 38 76
Direct pages scanned 17463 34865
Kswapd pages scanned 93331163 93302388
Kswapd pages reclaimed 93328173 93299677Direct pages reclaimed 17463 34865
Kswapd efficiency 99% 99%
Kswapd velocity 13729.855 13755.612
Direct efficiency 100% 100%
Direct velocity 2.569 5.140
Percentage direct scans 0% 0%
Page writes by reclaim 0 0 Page writes file 0 0 Page writes anon 0 0
Page reclaim immediate 54 36
kswapd activity was roughly comparable. There was slight differences in direct reclaim activity but negligible in the context of the overall workload (velocity of 5 pages per second with the patches applied, 2 pages per second in the baseline kernel).
pgbench read-only large configuration on ext4
---------------------------------------------
pgbench is a database benchmark that can be sensitive to page reclaim decisions. This also checks if removing the fair zone allocation policy is safe
pgbench Transactions
4.7.0-rc3 4.7.0-rc3
mmotm-20160615 nodelru-v7r17
Hmean 1 191.00 ( 0.00%) 193.67 ( 1.40%)
Hmean 5 338.59 ( 0.00%) 336.99 ( -0.47%)
Hmean 12 374.03 ( 0.00%) 386.15 ( 3.24%)
Hmean 21 372.24 ( 0.00%) 372.02 ( -0.06%)
Hmean 30 383.98 ( 0.00%) 370.69 ( -3.46%)
Hmean 32 431.01 ( 0.00%) 438.47 ( 1.73%)Negligible differences again. As with tiobench, overall reclaim activity was comparable.
bonnie++ on ext4
----------------
No interesting performance difference, negligible differences on reclaim stats.
paralleldd on ext4
------------------
This workload uses varying numbers of dd instances to read large amounts of data from disk.
paralleldd
4.7.0-rc3 4.7.0-rc3
mmotm-20160615 nodelru-v7r17
Amean Elapsd-1 181.57 ( 0.00%) 179.63 ( 1.07%)
Amean Elapsd-3 188.29 ( 0.00%) 183.68 ( 2.45%)
Amean Elapsd-5 188.02 ( 0.00%) 181.73 ( 3.35%)
Amean Elapsd-7 186.07 ( 0.00%) 184.11 ( 1.05%)
Amean Elapsd-12 188.16 ( 0.00%) 183.51 ( 2.47%)
Amean Elapsd-16 189.03 ( 0.00%) 181.27 ( 4.10%) 4.7.0-rc3 4.7.0-rc3
mmotm-20160615nodelru-v7r17
User 1439.23 1433.37
System 8332.31 8216.01
Elapsed 3619.80 3532.69There is a slight gain in performance, some of which is from the reduced system CPU usage. There areminor differences in reclaim activity but nothing significant
4.7.0-rc3 4.7.0-rc3
mmotm-20160615nodelru-v7r17Minor Faults 362486 358215
Major Faults 1143 1113
Swap Ins 26 0
Swap Outs 2920 482
DMA allocs 0 0
DMA32 allocs 31568814 28598887 Normal allocs 46539922 49514444 Movable allocs 0 0 Allocation stalls 0 0 Direct pages scanned 0 0 Kswapd pages scanned 40886878 40849710 Kswapd pages reclaimed 40869923 40835207
Direct pages reclaimed 0 0
Kswapd efficiency 99% 99%
Kswapd velocity 11295.342 11563.344
Direct efficiency 100% 100%
Direct velocity 0.000 0.000
Slabs scanned 131673 126099
Direct inode steals 57 60
Kswapd inode steals 762 18
It basically shows that kswapd was active at roughly the same rate in both kernels. There was also comparable slab scanning activity and direct reclaim was avoided in both cases. There appears to be a large difference in numbers of inodes reclaimed but the workload has few active inodes and is likely a timing artifact. It's interesting to note that the node-lru did not swap in any pages but given the low swap activity, it's unlikely to be significant.
stutter
-------
stutter simulates a simple workload. One part uses a lot of anonymous memory, a second measures mmap latency and a third copies a large file. The primary metric is checking for mmap latency.
stutter
4.7.0-rc3 4.7.0-rc3
mmotm-20160615 nodelru-v7r17
Min mmap 16.8422 ( 0.00%) 15.9821 ( 5.11%)
1st-qrtle mmap 57.8709 ( 0.00%) 58.0794 ( -0.36%)
2nd-qrtle mmap 58.4335 ( 0.00%) 59.4286 ( -1.70%)
3rd-qrtle mmap 58.6957 ( 0.00%) 59.6862 ( -1.69%)
Max-90% mmap 58.9388 ( 0.00%) 59.8759 ( -1.59%)
Max-93% mmap 59.0505 ( 0.00%) 59.9333 ( -1.50%)
Max-95% mmap 59.1877 ( 0.00%) 59.9844 ( -1.35%)
Max-99% mmap 60.3237 ( 0.00%) 60.2337 ( 0.15%)
Max mmap 285.6454 ( 0.00%) 135.6006 ( 52.53%)
Mean mmap 57.8366 ( 0.00%) 58.4884 ( -1.13%)This shows that there is a slight impact on mmap latency but that the worst-case outlier is much improved. As the problem with this benchmark used to be that the kernel stalled for minutes, this difference is negligible.
Some of the vmstats are interesting
4.7.0-rc3 4.7.0-rc3
mmotm-20160615nodelru-v7r17
Swap Ins 58 42
Swap Outs 0 0
Allocation stalls 16 0
Direct pages scanned 1374 0
Kswapd pages scanned 42454910 41782544
Kswapd pages reclaimed 41571035 41781833Direct pages reclaimed 1167 0
Kswapd efficiency 97% 99%
Kswapd velocity 14774.479 14223.796
Direct efficiency 84% 100%
Direct velocity 0.478 0.000
Percentage direct scans 0% 0%
Page writes by reclaim 696918 0 Page writes file 696918 0 Page writes anon 0 0 Page reclaim immediate 2940 137 Sector Reads 81644424 81699544 Sector Writes 99193620 98862160
Page rescued immediate 0 0
Slabs scanned 1279838 22640
kswapd and direct reclaim activity are similar but the node LRU series did not attempt to trigger any page writes from reclaim context.
This series is not without its hazards. There are at least three areas that I'm concerned with even though I could not reproduce any problems in that area.
1. Reclaim/compaction is going to be affected because the amount of reclaim is no longer targetted at a specific zone. Compaction works on a per-zone basis so there is no guarantee that reclaiming a few THP's worth page pages will have a positive impact on compaction success rates.
2. The Slab/LRU reclaim ratio is affected because the frequency the shrinkers are called is now different. This may or may not be a problem but if it is, it'll be because shrinkers are not called enough and some balancing is required.
3. The anon/file reclaim ratio may be affected. Pages about to be dirtied are distributed between zones and the fair zone allocation policy used to do something very similar for anon. The distribution is now different but not necessarily in any way that matters but it's still worth bearing in mind.
Documentation/cgroup-v1/memcg_test.txt | 4 +- Documentation/cgroup-v1/memory.txt | 4 +- arch/s390/appldata/appldata_mem.c | 2 +- arch/tile/mm/pgtable.c | 18 +- drivers/base/node.c | 73 +-- drivers/staging/android/lowmemorykiller.c | 12 +- fs/fs-writeback.c | 4 +- fs/fuse/file.c | 8 +- fs/nfs/internal.h | 2 +- fs/nfs/write.c | 2 +- fs/proc/meminfo.c | 14 +- include/linux/backing-dev.h | 2 +- include/linux/memcontrol.h | 32 +- include/linux/mm.h | 5 + include/linux/mm_inline.h | 21 +- include/linux/mm_types.h | 2 +- include/linux/mmzone.h | 158 +++--- include/linux/swap.h | 23 +- include/linux/topology.h | 2 +- include/linux/vm_event_item.h | 14 +- include/linux/vmstat.h | 111 +++- include/linux/writeback.h | 2 +- include/trace/events/vmscan.h | 63 ++- include/trace/events/writeback.h | 10 +- kernel/power/snapshot.c | 10 +- kernel/sysctl.c | 4 +- mm/backing-dev.c | 15 +- mm/compaction.c | 28 +- mm/filemap.c | 14 +- mm/huge_memory.c | 33 +- mm/internal.h | 11 +- mm/memcontrol.c | 246 ++++---- mm/memory-failure.c | 4 +- mm/memory_hotplug.c | 7 +- mm/mempolicy.c | 2 +- mm/migrate.c | 35 +- mm/mlock.c | 12 +- mm/page-writeback.c | 124 ++-- mm/page_alloc.c | 268 ++++----- mm/page_idle.c | 4 +- mm/rmap.c | 14 +- mm/shmem.c | 12 +- mm/swap.c | 66 +-- mm/swap_state.c | 4 +- mm/util.c | 4 +- mm/vmscan.c | 901 +++++++++++++++--------------- mm/vmstat.c | 376 ++++++++++--- mm/workingset.c | 54 +- 48 files changed, 1573 insertions(+), 1263 deletions(-)
Signature · 7 lines
2.6.4 -- 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>
PATCH 1/27 mm, vmstat: Add infrastructure for per-node vmstats
VM statistic counters for reclaim decisions are zone-based. If the kernel is to reclaim on a per-node basis then we need to track per-node statistics but there is no infrastructure for that. The most notable change is that the old node_page_state is renamed to sum_zone_node_page_state. The new node_page_state takes a pglist_data and uses per-node stats but none exist yet. There is some renaming such as vm_stat to vm_zone_stat and the addition of vm_node_stat and the renaming of mod_state to mod_zone_state. Otherwise, this is mostly a mechanical patch with no functional change. There is a lot of similarity between the node and zone helpers which is unfortunate but there was no obvious way of reusing the code and maintaining type safety.
--- drivers/base/node.c | 72 +++++++------ include/linux/mm.h | 5 + include/linux/mmzone.h | 13 +++ include/linux/vmstat.h | 92 +++++++++++++--- mm/page_alloc.c | 10 +- mm/vmstat.c | 282 +++++++++++++++++++++++++++++++++++++++++++++---- mm/workingset.c | 9 +- 7 files changed, 409 insertions(+), 74 deletions(-)
drivers/base/node.c +39 -33
@@ -74,16 +74,16 @@ static ssize_t node_read_meminfo(struct device *dev, nid,K (i.totalram), nid,K (i.freeram), nid,K (i.totalram - i.freeram), - nid,K (node_page_state (nid,NR_ACTIVE_ANON ) + -node_page_state (nid,NR_ACTIVE_FILE )), - nid,K (node_page_state (nid,NR_INACTIVE_ANON ) + -node_page_state (nid,NR_INACTIVE_FILE )), - nid,K (node_page_state (nid,NR_ACTIVE_ANON )), - nid,K (node_page_state (nid,NR_INACTIVE_ANON )), - nid,K (node_page_state (nid,NR_ACTIVE_FILE )), - nid,K (node_page_state (nid,NR_INACTIVE_FILE )), - nid,K (node_page_state (nid,NR_UNEVICTABLE )), - nid, K(node_page_state(nid, NR_MLOCK))); + nid,K (sum_zone_node_page_state (nid,NR_ACTIVE_ANON ) + +sum_zone_node_page_state (nid,NR_ACTIVE_FILE )), + nid,K (sum_zone_node_page_state (nid,NR_INACTIVE_ANON ) + +sum_zone_node_page_state (nid,NR_INACTIVE_FILE )), + nid,K (sum_zone_node_page_state (nid,NR_ACTIVE_ANON )), + nid,K (sum_zone_node_page_state (nid,NR_INACTIVE_ANON )), + nid,K (sum_zone_node_page_state (nid,NR_ACTIVE_FILE )), + nid,K (sum_zone_node_page_state (nid,NR_INACTIVE_FILE )), + nid,K (sum_zone_node_page_state (nid,NR_UNEVICTABLE )), + nid, K(sum_zone_node_page_state(nid, NR_MLOCK)));#ifdef CONFIG_HIGHMEM n += sprintf(buf + n,
@@ -115,28 +115,28 @@ static ssize_t node_read_meminfo(struct device *dev,"Node %d AnonHugePages: %8lu kB\n" #endif , - nid,K (node_page_state (nid,NR_FILE_DIRTY )), - nid,K (node_page_state (nid,NR_WRITEBACK )), - nid,K (node_page_state (nid,NR_FILE_PAGES )), - nid,K (node_page_state (nid,NR_FILE_MAPPED )), - nid,K (node_page_state (nid,NR_ANON_PAGES )), + nid,K (sum_zone_node_page_state (nid,NR_FILE_DIRTY )), + nid,K (sum_zone_node_page_state (nid,NR_WRITEBACK )), + nid,K (sum_zone_node_page_state (nid,NR_FILE_PAGES )), + nid,K (sum_zone_node_page_state (nid,NR_FILE_MAPPED )), + nid,K (sum_zone_node_page_state (nid,NR_ANON_PAGES )), nid,K (i.sharedram), - nid,node_page_state (nid,NR_KERNEL_STACK ) * + nid,sum_zone_node_page_state (nid,NR_KERNEL_STACK ) *THREAD_SIZE /1024 , - nid,K (node_page_state (nid,NR_PAGETABLE )), - nid,K (node_page_state (nid,NR_UNSTABLE_NFS )), - nid,K (node_page_state (nid,NR_BOUNCE )), - nid,K (node_page_state (nid,NR_WRITEBACK_TEMP )), - nid,K (node_page_state (nid,NR_SLAB_RECLAIMABLE ) + -node_page_state (nid,NR_SLAB_UNRECLAIMABLE )), - nid,K (node_page_state (nid,NR_SLAB_RECLAIMABLE )), + nid,K (sum_zone_node_page_state (nid,NR_PAGETABLE )), + nid,K (sum_zone_node_page_state (nid,NR_UNSTABLE_NFS )), + nid,K (sum_zone_node_page_state (nid,NR_BOUNCE )), + nid,K (sum_zone_node_page_state (nid,NR_WRITEBACK_TEMP )), + nid,K (sum_zone_node_page_state (nid,NR_SLAB_RECLAIMABLE ) + +sum_zone_node_page_state (nid,NR_SLAB_UNRECLAIMABLE )), + nid,K (sum_zone_node_page_state (nid,NR_SLAB_RECLAIMABLE )), #ifdef CONFIG_TRANSPARENT_HUGEPAGE - nid,K (node_page_state (nid,NR_SLAB_UNRECLAIMABLE )) + nid,K (sum_zone_node_page_state (nid,NR_SLAB_UNRECLAIMABLE )) , nid, -K (node_page_state (nid,NR_ANON_TRANSPARENT_HUGEPAGES ) * +K (sum_zone_node_page_state (nid,NR_ANON_TRANSPARENT_HUGEPAGES ) * HPAGE_PMD_NR));#else - nid, K(node_page_state(nid, NR_SLAB_UNRECLAIMABLE))); + nid, K(sum_zone_node_page_state(nid, NR_SLAB_UNRECLAIMABLE)));#endif n +=hugetlb_report_node_meminfo (nid, buf + n);return n;
@@ -155,12 +155,12 @@ static ssize_t node_read_numastat(struct device *dev,"interleave_hit %lu\n" "local_node %lu\n" "other_node %lu\n" , -node_page_state (dev->id,NUMA_HIT ), -node_page_state (dev->id,NUMA_MISS ), -node_page_state (dev->id,NUMA_FOREIGN ), -node_page_state (dev->id,NUMA_INTERLEAVE_HIT ), -node_page_state (dev->id,NUMA_LOCAL ), - node_page_state(dev->id, NUMA_OTHER)); +sum_zone_node_page_state (dev->id,NUMA_HIT ), +sum_zone_node_page_state (dev->id,NUMA_MISS ), +sum_zone_node_page_state (dev->id,NUMA_FOREIGN ), +sum_zone_node_page_state (dev->id,NUMA_INTERLEAVE_HIT ), +sum_zone_node_page_state (dev->id,NUMA_LOCAL ), + sum_zone_node_page_state(dev->id, NUMA_OTHER)); } static DEVICE_ATTR(numastat, S_IRUGO, node_read_numastat, NULL);
@@ -168,12 +168,18 @@ static ssize_t node_read_vmstat(struct device *dev, struct device_attribute *attr, char *buf) { int nid = dev->id; +struct pglist_data *pgdat =NODE_DATA (nid);int i;int n =0 ;for (i =0 ; i <NR_VM_ZONE_STAT_ITEMS ; i++) n +=sprintf (buf+n,"%s %lu\n" , vmstat_text[i], -node_page_state (nid, i)); +sum_zone_node_page_state (nid, i)); + +for (i =0 ; i <NR_VM_NODE_STAT_ITEMS ; i++) + n +=sprintf (buf+n,"%s %lu\n" , + vmstat_text[i +NR_VM_ZONE_STAT_ITEMS ], +node_page_state (pgdat, i));return n; }
include/linux/mm.h +5 -0
@@ -908,6 +908,11 @@ static inline struct zone *page_zone(const struct page *page)return &NODE_DATA (page_to_nid (page))->node_zones[page_zonenum (page)]; } +static inline pg_data_t *page_pgdat (const struct page *page) +{ +return NODE_DATA (page_to_nid (page)); +} +#ifdef SECTION_IN_PAGE_FLAGS static inline void set_page_section (struct page *page,unsigned long section) {
include/linux/mmzone.h +13 -0
@@ -158,6 +158,10 @@ enum zone_stat_item {NR_FREE_CMA_PAGES , NR_VM_ZONE_STAT_ITEMS }; +enum node_stat_item { +NR_VM_NODE_STAT_ITEMS +}; +/* * We do arithmetic on the LRU lists in various places in the code, * so it is important to keep the active lists LRU_ACTIVE higher in
@@ -265,6 +269,11 @@ struct per_cpu_pageset {#endif }; +struct per_cpu_nodestat { +s8 stat_threshold; +s8 vm_node_stat_diff[NR_VM_NODE_STAT_ITEMS ]; +}; +#endif /* !__GENERATING_BOUNDS.H */ enum zone_type {
@@ -693,6 +702,10 @@ typedef struct pglist_data {struct list_head split_queue;unsigned long split_queue_len;#endif + +/* Per-node vmstats */ +struct per_cpu_nodestat __percpu *per_cpu_nodestats; +atomic_long_t vm_stat[NR_VM_NODE_STAT_ITEMS ]; } pg_data_t;#define node_present_pages (nid) (NODE_DATA(nid)->node_present_pages)
include/linux/vmstat.h +80 -12
166 lines not on this page · raw message
mm/page_alloc.c +8 -2
@@ -4209,8 +4209,8 @@ void si_meminfo_node(struct sysinfo *val, int nid)for (zone_type =0 ; zone_type <MAX_NR_ZONES ; zone_type++) managed_pages += pgdat->node_zones[zone_type].managed_pages; val->totalram = managed_pages; - val->sharedram =node_page_state (nid,NR_SHMEM ); - val->freeram =node_page_state (nid,NR_FREE_PAGES ); + val->sharedram =sum_zone_node_page_state (nid,NR_SHMEM ); + val->freeram =sum_zone_node_page_state (nid,NR_FREE_PAGES );#ifdef CONFIG_HIGHMEM for (zone_type =0 ; zone_type <MAX_NR_ZONES ; zone_type++) {struct zone *zone = &pgdat->node_zones[zone_type];
@@ -5316,6 +5316,11 @@ static void __meminit setup_zone_pageset(struct zone *zone) zone->pageset = alloc_percpu(struct per_cpu_pageset);for_each_possible_cpu (cpu)zone_pageset_init (zone, cpu); + +if (!zone->zone_pgdat->per_cpu_nodestats) { + zone->zone_pgdat->per_cpu_nodestats = + alloc_percpu(struct per_cpu_nodestat); + } }/*
@@ -6021,6 +6026,7 @@ void __paginginit free_area_init_node(int nid, unsigned long *zones_size,reset_deferred_meminit (pgdat); pgdat->node_id = nid; pgdat->node_start_pfn = node_start_pfn; + pgdat->per_cpu_nodestats =NULL ;#ifdef CONFIG_HAVE_MEMBLOCK_NODE_MAP get_pfn_range_for_nid (nid, &start_pfn, &end_pfn); pr_info("Initmem setup node %d [mem %#018Lx-%#018Lx]\n", nid,
mm/vmstat.c +259 -23
449 lines not on this page · raw message
mm/workingset.c +5 -4
@@ -349,12 +349,13 @@ static unsigned long count_shadow_nodes(struct shrinker *shrinker, shadow_nodes =list_lru_shrink_count (&workingset_shadow_nodes, sc);local_irq_enable (); -if (memcg_kmem_enabled ()) +if (memcg_kmem_enabled ()) { pages =mem_cgroup_node_nr_lru_pages (sc->memcg, sc->nid,LRU_ALL_FILE ); -else - pages =node_page_state (sc->nid,NR_ACTIVE_FILE ) + -node_page_state (sc->nid,NR_INACTIVE_FILE ); + }else { + pages =sum_zone_node_page_state (sc->nid,NR_ACTIVE_FILE ) + +sum_zone_node_page_state (sc->nid,NR_INACTIVE_FILE ); + }/* * Active cache pages are limited to 50% of memory, and shadow
Signature · 7 lines
2.6.4 -- 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>
PATCH 2/27 mm, vmscan: Move lru_lock to the node
In reply to Mel GormanNode-based reclaim requires node-based LRUs and locking. This is a preparation patch that just moves the lru_lock to the node so later patches are easier to review. It is a mechanical change but note this patch makes contention worse because the LRU lock is hotter and direct reclaim and kswapd can contend on the same lock even when reclaiming from different zones.
--- Documentation/cgroup-v1/memcg_test.txt | 4 +-- Documentation/cgroup-v1/memory.txt | 4 +-- include/linux/mm_types.h | 2 +- include/linux/mmzone.h | 10 +++++-- mm/compaction.c | 10 +++---- mm/filemap.c | 4 +-- mm/huge_memory.c | 4 +-- mm/memcontrol.c | 6 ++--- mm/mlock.c | 10 +++---- mm/page_alloc.c | 4 +-- mm/page_idle.c | 4 +-- mm/rmap.c | 2 +- mm/swap.c | 30 ++++++++++----------- mm/vmscan.c | 48 +++++++++++++++++----------------- 14 files changed, 74 insertions(+), 68 deletions(-)
Documentation/cgroup-v1/memcg_test.txt +2 -2
@@ -107,9 +107,9 @@ Under below explanation, we assume CONFIG_MEM_RES_CTRL_SWAP=y. 8. LRU Each memcg has its own private LRU. Now, its handling is under global - VM's control (means that it's handled under global zone->lru_lock). + VM's control (means that it's handled under global zone_lru_lock). Almost all routines around memcg's LRU is called by global LRU's - list management functions under zone->lru_lock(). + list management functions under zone_lru_lock(). A special function is mem_cgroup_isolate_pages(). This scans memcg's private LRU and call __isolate_lru_page() to extract a page
Documentation/cgroup-v1/memory.txt +2 -2
@@ -267,11 +267,11 @@ When oom event notifier is registered, event will be delivered. Other lock order is following: PG_locked. mm->page_table_lock - zone->lru_lock + zone_lru_lock lock_page_cgroup. In many cases, just lock_page_cgroup() is called. per-zone-per-cgroup LRU (cgroup's private LRU) is just guarded by - zone->lru_lock, it has no lock of its own. + zone_lru_lock, it has no lock of its own. 2.7 Kernel Memory Extension (CONFIG_MEMCG_KMEM)
include/linux/mm_types.h +1 -1
@@ -118,7 +118,7 @@ struct page {*/ union {struct list_head lru;/* Pageout list, eg. active_list -* protected by zone->lru_lock ! +* protected by zone_lru_lock ! * Can be used as a generic list * by the page owner. */
include/linux/mmzone.h +8 -2
@@ -93,7 +93,7 @@ struct free_area {struct pglist_data ;/* -* zone->lock and zone->lru_lock are two of the hottest locks in the kernel. +* zone->lock and the zone lru_lock are two of the hottest locks in the kernel. * So add a wild amount of padding here to ensure that they fall into separate * cachelines. There are very few zone structures in the machine, so space * consumption is not a concern here.
@@ -494,7 +494,6 @@ struct zone {/* Write-intensive fields used by page reclaim */ /* Fields commonly accessed by the page reclaim scanner */ -spinlock_t lru_lock;struct lruvec lruvec;/*
@@ -688,6 +687,9 @@ typedef struct pglist_data {/* Number of pages migrated during the rate limiting time interval */ unsigned long numabalancing_migrate_nr_pages;#endif +/* Write-intensive fields used from the page allocator */ +ZONE_PADDING (_pad1_) + spinlock_t lru_lock;#ifdef CONFIG_DEFERRED_STRUCT_PAGE_INIT /*
@@ -719,6 +721,10 @@ typedef struct pglist_data {#define node_start_pfn (nid) (NODE_DATA(nid)->node_start_pfn)#define node_end_pfn (nid) pgdat_end_pfn(NODE_DATA(nid)) +static inline spinlock_t *zone_lru_lock (struct zone *zone) +{ +return &zone->zone_pgdat->lru_lock; +}static inline unsigned long pgdat_end_pfn (pg_data_t *pgdat) {
mm/compaction.c +5 -5
@@ -754,7 +754,7 @@ isolate_migratepages_block(struct compact_control *cc, unsigned long low_pfn,* if contended. */ if (!(low_pfn %SWAP_CLUSTER_MAX ) - &&compact_unlock_should_abort (&zone->lru_lock, flags, + &&compact_unlock_should_abort (zone_lru_lock (zone), flags, &locked, cc))break ;
@@ -816,7 +816,7 @@ isolate_migratepages_block(struct compact_control *cc, unsigned long low_pfn,if (unlikely (__PageMovable (page)) && !PageIsolated (page)) {if (locked) { -spin_unlock_irqrestore (&zone->lru_lock, +spin_unlock_irqrestore (zone_lru_lock (zone), flags); locked = false; }
@@ -839,7 +839,7 @@ isolate_migratepages_block(struct compact_control *cc, unsigned long low_pfn,/* If we already hold the lock, we can skip some rechecking */ if (!locked) { - locked =compact_trylock_irqsave (&zone->lru_lock, + locked =compact_trylock_irqsave (zone_lru_lock (zone), &flags, cc);if (!locked)break ;
@@ -902,7 +902,7 @@ isolate_migratepages_block(struct compact_control *cc, unsigned long low_pfn,*/ if (nr_isolated) {if (locked) { -spin_unlock_irqrestore (&zone->lru_lock, flags); +spin_unlock_irqrestore (zone_lru_lock (zone), flags); locked = false; }acct_isolated (zone, cc);
@@ -930,7 +930,7 @@ isolate_migratepages_block(struct compact_control *cc, unsigned long low_pfn, low_pfn = end_pfn;if (locked) -spin_unlock_irqrestore (&zone->lru_lock, flags); +spin_unlock_irqrestore (zone_lru_lock (zone), flags);/* * Update the pageblock-skip information and cached scanner pfn,
mm/filemap.c +2 -2
@@ -95,8 +95,8 @@* ->swap_lock (try_to_unmap_one) * ->private_lock (try_to_unmap_one) * ->tree_lock (try_to_unmap_one) -* ->zone.lru_lock (follow_page->mark_page_accessed) -* ->zone.lru_lock (check_pte_range->isolate_lru_page) +* ->zone_lru_lock(zone) (follow_page->mark_page_accessed) +* ->zone_lru_lock(zone) (check_pte_range->isolate_lru_page) * ->private_lock (page_remove_rmap->set_page_dirty) * ->tree_lock (page_remove_rmap->set_page_dirty) * bdi.wb->list_lock (page_remove_rmap->set_page_dirty)
mm/huge_memory.c +2 -2
@@ -3305,7 +3305,7 @@ static void __split_huge_page(struct page *page, struct list_head *list)int i;/* prevent PageLRU to go away from under us, and freeze lru stats */ -spin_lock_irq (&zone->lru_lock); +spin_lock_irq (zone_lru_lock (zone)); lruvec =mem_cgroup_page_lruvec (head, zone);/* complete memcg works before add pages to LRU */
@@ -3315,7 +3315,7 @@ static void __split_huge_page(struct page *page, struct list_head *list)__split_huge_page_tail (head, i, lruvec, list);ClearPageCompound (head); -spin_unlock_irq (&zone->lru_lock); +spin_unlock_irq (zone_lru_lock (zone));unfreeze_page (head);
mm/memcontrol.c +3 -3
@@ -2107,7 +2107,7 @@ static void lock_page_lru(struct page *page, int *isolated) {struct zone *zone =page_zone (page); -spin_lock_irq (&zone->lru_lock); +spin_lock_irq (zone_lru_lock (zone));if (PageLRU (page)) {struct lruvec *lruvec;
@@ -2131,7 +2131,7 @@ static void unlock_page_lru(struct page *page, int isolated)SetPageLRU (page);add_page_to_lru_list (page, lruvec,page_lru (page)); } -spin_unlock_irq (&zone->lru_lock); +spin_unlock_irq (zone_lru_lock (zone)); } static void commit_charge(struct page *page, struct mem_cgroup *memcg,
@@ -2431,7 +2431,7 @@ void memcg_kmem_uncharge(struct page *page, int order)/* * Because tail pages are not marked as "used", set it. We're under -* zone->lru_lock and migration entries setup in all page mappings. +* zone_lru_lock and migration entries setup in all page mappings. */ void mem_cgroup_split_huge_fixup (struct page *head) {
mm/mlock.c +5 -5
@@ -188,7 +188,7 @@ unsigned int munlock_vma_page(struct page *page)* might otherwise copy PageMlocked to part of the tail pages before * we clear it in the head page. It also stabilizes hpage_nr_pages(). */ -spin_lock_irq (&zone->lru_lock); +spin_lock_irq (zone_lru_lock (zone)); nr_pages =hpage_nr_pages (page);if (!TestClearPageMlocked (page))
@@ -197,14 +197,14 @@ unsigned int munlock_vma_page(struct page *page)__mod_zone_page_state (zone,NR_MLOCK , -nr_pages);if (__munlock_isolate_lru_page (page, true)) { -spin_unlock_irq (&zone->lru_lock); +spin_unlock_irq (zone_lru_lock (zone));__munlock_isolated_page (page); goto out; }__munlock_isolation_failed (page); unlock_out: -spin_unlock_irq (&zone->lru_lock); +spin_unlock_irq (zone_lru_lock (zone)); out:return nr_pages -1 ;
@@ -289,7 +289,7 @@ static void __munlock_pagevec(struct pagevec *pvec, struct zone *zone)pagevec_init (&pvec_putback,0 );/* Phase 1: page isolation */ -spin_lock_irq (&zone->lru_lock); +spin_lock_irq (zone_lru_lock (zone));for (i =0 ; i < nr; i++) {struct page *page = pvec->pages[i];
@@ -315,7 +315,7 @@ static void __munlock_pagevec(struct pagevec *pvec, struct zone *zone) } delta_munlocked = -nr +pagevec_count (&pvec_putback);__mod_zone_page_state (zone,NR_MLOCK , delta_munlocked); -spin_unlock_irq (&zone->lru_lock); +spin_unlock_irq (zone_lru_lock (zone));/* Now we can release pins of pages that we are not munlocking */ pagevec_release (&pvec_putback);
mm/page_alloc.c +2 -2
@@ -5890,6 +5890,7 @@ static void __paginginit free_area_init_core(struct pglist_data *pgdat)init_waitqueue_head (&pgdat->kcompactd_wait);#endif pgdat_page_ext_init (pgdat); +spin_lock_init (&pgdat->lru_lock);for (j =0 ; j <MAX_NR_ZONES ; j++) {struct zone *zone = pgdat->node_zones + j;
@@ -5944,10 +5945,9 @@ static void __paginginit free_area_init_core(struct pglist_data *pgdat) zone->min_slab_pages = (freesize * sysctl_min_slab_ratio) /100 ;#endif zone->name = zone_names[j]; + zone->zone_pgdat = pgdat;spin_lock_init (&zone->lock); -spin_lock_init (&zone->lru_lock);zone_seqlock_init (zone); - zone->zone_pgdat = pgdat;zone_pcp_init (zone);/* For bootup, initialized properly in watermark setup */
mm/page_idle.c +2 -2
@@ -41,12 +41,12 @@ static struct page *page_idle_get_page(unsigned long pfn)return NULL ; zone =page_zone (page); -spin_lock_irq (&zone->lru_lock); +spin_lock_irq (zone_lru_lock (zone));if (unlikely (!PageLRU (page))) {put_page (page); page =NULL ; } -spin_unlock_irq (&zone->lru_lock); +spin_unlock_irq (zone_lru_lock (zone));return page; }
mm/rmap.c +1 -1
@@ -27,7 +27,7 @@* mapping->i_mmap_rwsem * anon_vma->rwsem * mm->page_table_lock or pte_lock -* zone->lru_lock (in mark_page_accessed, isolate_lru_page) +* zone_lru_lock (in mark_page_accessed, isolate_lru_page) * swap_lock (in swap_duplicate, swap_info_get) * mmlist_lock (in mmput, drain_mmlist and others) * mapping->private_lock (in __set_page_dirty_buffers)
mm/swap.c +15 -15
@@ -62,12 +62,12 @@ static void __page_cache_release(struct page *page)struct lruvec *lruvec;unsigned long flags; -spin_lock_irqsave (&zone->lru_lock, flags); +spin_lock_irqsave (zone_lru_lock (zone), flags); lruvec =mem_cgroup_page_lruvec (page, zone);VM_BUG_ON_PAGE (!PageLRU (page), page);__ClearPageLRU (page);del_page_from_lru_list (page, lruvec,page_off_lru (page)); -spin_unlock_irqrestore (&zone->lru_lock, flags); +spin_unlock_irqrestore (zone_lru_lock (zone), flags); }mem_cgroup_uncharge (page); }
@@ -189,16 +189,16 @@ static void pagevec_lru_move_fn(struct pagevec *pvec,if (pagezone != zone) {if (zone) -spin_unlock_irqrestore (&zone->lru_lock, flags); +spin_unlock_irqrestore (zone_lru_lock (zone), flags); zone = pagezone; -spin_lock_irqsave (&zone->lru_lock, flags); +spin_lock_irqsave (zone_lru_lock (zone), flags); } lruvec =mem_cgroup_page_lruvec (page, zone); (*move_fn)(page, lruvec, arg); }if (zone) -spin_unlock_irqrestore (&zone->lru_lock, flags); +spin_unlock_irqrestore (zone_lru_lock (zone), flags);release_pages (pvec->pages, pvec->nr, pvec->cold);pagevec_reinit (pvec); }
@@ -316,9 +316,9 @@ void activate_page(struct page *page) {struct zone *zone =page_zone (page); -spin_lock_irq (&zone->lru_lock); +spin_lock_irq (zone_lru_lock (zone));__activate_page (page,mem_cgroup_page_lruvec (page, zone),NULL ); -spin_unlock_irq (&zone->lru_lock); +spin_unlock_irq (zone_lru_lock (zone)); }#endif
@@ -447,13 +447,13 @@ void add_page_to_unevictable_list(struct page *page)struct zone *zone =page_zone (page);struct lruvec *lruvec; -spin_lock_irq (&zone->lru_lock); +spin_lock_irq (zone_lru_lock (zone)); lruvec =mem_cgroup_page_lruvec (page, zone);ClearPageActive (page);SetPageUnevictable (page);SetPageLRU (page);add_page_to_lru_list (page, lruvec,LRU_UNEVICTABLE ); -spin_unlock_irq (&zone->lru_lock); +spin_unlock_irq (zone_lru_lock (zone)); }/**
@@ -743,7 +743,7 @@ void release_pages(struct page **pages, int nr, bool cold)* same zone. The lock is held only if zone != NULL. */ if (zone && ++lock_batch ==SWAP_CLUSTER_MAX ) { -spin_unlock_irqrestore (&zone->lru_lock, flags); +spin_unlock_irqrestore (zone_lru_lock (zone), flags); zone =NULL ; }
@@ -758,7 +758,7 @@ void release_pages(struct page **pages, int nr, bool cold)if (PageCompound (page)) {if (zone) { -spin_unlock_irqrestore (&zone->lru_lock, flags); +spin_unlock_irqrestore (zone_lru_lock (zone), flags); zone =NULL ; }__put_compound_page (page);
@@ -770,11 +770,11 @@ void release_pages(struct page **pages, int nr, bool cold)if (pagezone != zone) {if (zone) -spin_unlock_irqrestore (&zone->lru_lock, +spin_unlock_irqrestore (zone_lru_lock (zone), flags); lock_batch =0 ; zone = pagezone; -spin_lock_irqsave (&zone->lru_lock, flags); +spin_lock_irqsave (zone_lru_lock (zone), flags); } lruvec =mem_cgroup_page_lruvec (page, zone);
@@ -789,7 +789,7 @@ void release_pages(struct page **pages, int nr, bool cold)list_add (&page->lru, &pages_to_free); }if (zone) -spin_unlock_irqrestore (&zone->lru_lock, flags); +spin_unlock_irqrestore (zone_lru_lock (zone), flags);mem_cgroup_uncharge_list (&pages_to_free);free_hot_cold_page_list (&pages_to_free, cold);
@@ -825,7 +825,7 @@ void lru_add_page_tail(struct page *page, struct page *page_tail,VM_BUG_ON_PAGE (PageCompound (page_tail), page);VM_BUG_ON_PAGE (PageLRU (page_tail), page);VM_BUG_ON (NR_CPUS !=1 && - !spin_is_locked (&lruvec_zone (lruvec)->lru_lock)); + !spin_is_locked (zone_lru_lock (lruvec_zone (lruvec))));if (!list)SetPageLRU (page_tail);
mm/vmscan.c +24 -24
169 lines not on this page · raw message
Signature · 7 lines
2.6.4 -- 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>
PATCH 3/27 mm, vmscan: Move LRU lists to node
In reply to Mel GormanThis moves the LRU lists from the zone to the node and related data such as counters, tracing, congestion tracking and writeback tracking. Unfortunately, due to reclaim and compaction retry logic, it is necessary to account for the number of LRU pages on both zone and node logic. Most reclaim logic is based on the node counters but the retry logic uses the zone counters which do not distinguish inactive and inactive sizes. It would be possible to leave the LRU counters on a per-zone basis but it's a heavier calculation across multiple cache lines that is much more frequent than the retry checks.
Other than the LRU counters, this is mostly a mechanical patch but note that it introduces a number of anomalies. For example, the scans are per-zone but using per-node counters. We also mark a node as congested when a zone is congested. This causes weird problems that are fixed later but is easier to review.
--- arch/tile/mm/pgtable.c | 8 +- drivers/base/node.c | 19 +-- drivers/staging/android/lowmemorykiller.c | 8 +- include/linux/backing-dev.h | 2 +- include/linux/memcontrol.h | 10 +- include/linux/mm_inline.h | 21 ++- include/linux/mmzone.h | 69 +++++---- include/linux/swap.h | 1 + include/linux/vm_event_item.h | 10 +- include/linux/vmstat.h | 17 +++ include/trace/events/vmscan.h | 12 +- kernel/power/snapshot.c | 10 +- mm/backing-dev.c | 15 +- mm/compaction.c | 18 +-- mm/huge_memory.c | 6 +- mm/internal.h | 2 +- mm/memcontrol.c | 23 +-- mm/memory-failure.c | 4 +- mm/memory_hotplug.c | 2 +- mm/mempolicy.c | 2 +- mm/migrate.c | 21 +-- mm/mlock.c | 2 +- mm/page-writeback.c | 8 +- mm/page_alloc.c | 70 ++++----- mm/swap.c | 56 ++++---- mm/vmscan.c | 226 +++++++++++++++++------------- mm/vmstat.c | 47 ++++--- mm/workingset.c | 4 +- 28 files changed, 390 insertions(+), 303 deletions(-)
arch/tile/mm/pgtable.c +4 -4
@@ -45,10 +45,10 @@ void show_mem(unsigned int filter)struct zone *zone; pr_err("Active:%lu inactive:%lu dirty:%lu writeback:%lu unstable:%lu free:%lu\n slab:%lu mapped:%lu pagetables:%lu bounce:%lu pagecache:%lu swap:%lu\n", - (global_page_state(NR_ACTIVE_ANON) + - global_page_state(NR_ACTIVE_FILE)), - (global_page_state(NR_INACTIVE_ANON) + - global_page_state(NR_INACTIVE_FILE)), + (global_node_page_state(NR_ACTIVE_ANON) + + global_node_page_state(NR_ACTIVE_FILE)), + (global_node_page_state(NR_INACTIVE_ANON) + + global_node_page_state(NR_INACTIVE_FILE)), global_page_state(NR_FILE_DIRTY), global_page_state(NR_WRITEBACK), global_page_state(NR_UNSTABLE_NFS),
drivers/base/node.c +10 -9
@@ -56,6 +56,7 @@ static ssize_t node_read_meminfo(struct device *dev, {int n;int nid = dev->id; +struct pglist_data *pgdat =NODE_DATA (nid);struct sysinfo i;si_meminfo_node (&i, nid);
@@ -74,15 +75,15 @@ static ssize_t node_read_meminfo(struct device *dev, nid,K (i.totalram), nid,K (i.freeram), nid,K (i.totalram - i.freeram), - nid,K (sum_zone_node_page_state (nid,NR_ACTIVE_ANON ) + -sum_zone_node_page_state (nid,NR_ACTIVE_FILE )), - nid,K (sum_zone_node_page_state (nid,NR_INACTIVE_ANON ) + -sum_zone_node_page_state (nid,NR_INACTIVE_FILE )), - nid,K (sum_zone_node_page_state (nid,NR_ACTIVE_ANON )), - nid,K (sum_zone_node_page_state (nid,NR_INACTIVE_ANON )), - nid,K (sum_zone_node_page_state (nid,NR_ACTIVE_FILE )), - nid,K (sum_zone_node_page_state (nid,NR_INACTIVE_FILE )), - nid,K (sum_zone_node_page_state (nid,NR_UNEVICTABLE )), + nid,K (node_page_state (pgdat,NR_ACTIVE_ANON ) + +node_page_state (pgdat,NR_ACTIVE_FILE )), + nid,K (node_page_state (pgdat,NR_INACTIVE_ANON ) + +node_page_state (pgdat,NR_INACTIVE_FILE )), + nid,K (node_page_state (pgdat,NR_ACTIVE_ANON )), + nid,K (node_page_state (pgdat,NR_INACTIVE_ANON )), + nid,K (node_page_state (pgdat,NR_ACTIVE_FILE )), + nid,K (node_page_state (pgdat,NR_INACTIVE_FILE )), + nid,K (node_page_state (pgdat,NR_UNEVICTABLE )), nid, K(sum_zone_node_page_state(nid, NR_MLOCK)));#ifdef CONFIG_HIGHMEM
drivers/staging/android/lowmemorykiller.c +4 -4
@@ -72,10 +72,10 @@ static unsigned long lowmem_deathpending_timeout;static unsigned long lowmem_count (struct shrinker *s,struct shrink_control *sc) { -return global_page_state (NR_ACTIVE_ANON ) + -global_page_state (NR_ACTIVE_FILE ) + -global_page_state (NR_INACTIVE_ANON ) + -global_page_state (NR_INACTIVE_FILE ); +return global_node_page_state (NR_ACTIVE_ANON ) + +global_node_page_state (NR_ACTIVE_FILE ) + +global_node_page_state (NR_INACTIVE_ANON ) + +global_node_page_state (NR_INACTIVE_FILE ); }static unsigned long lowmem_scan (struct shrinker *s,struct shrink_control *sc)
include/linux/backing-dev.h +1 -1
@@ -197,7 +197,7 @@ static inline int wb_congested(struct bdi_writeback *wb, int cong_bits) }long congestion_wait (int sync,long timeout); -long wait_iff_congested (struct zone *zone,int sync,long timeout); +long wait_iff_congested (struct pglist_data *pgdat,int sync,long timeout);int pdflush_proc_obsolete (struct ctl_table *table,int write,void __user *buffer,size_t *lenp,loff_t *ppos);
include/linux/memcontrol.h +5 -5
@@ -307,7 +307,7 @@ void mem_cgroup_uncharge_list(struct list_head *page_list);void mem_cgroup_migrate (struct page *oldpage,struct page *newpage);struct lruvec *mem_cgroup_zone_lruvec (struct zone *,struct mem_cgroup *); -struct lruvec *mem_cgroup_page_lruvec (struct page *,struct zone *); +struct lruvec *mem_cgroup_page_lruvec (struct page *,struct pglist_data *);bool task_in_mem_cgroup (struct task_struct *task,struct mem_cgroup *memcg);struct mem_cgroup *mem_cgroup_from_task (struct task_struct *p);
@@ -401,7 +401,7 @@ static inline bool mem_cgroup_online(struct mem_cgroup *memcg)int mem_cgroup_select_victim_node (struct mem_cgroup *memcg);void mem_cgroup_update_lru_size (struct lruvec *lruvec,enum lru_list lru, -int nr_pages); +enum zone_type zid,int nr_pages);unsigned long mem_cgroup_node_nr_lru_pages (struct mem_cgroup *memcg,int nid,unsigned int lru_mask);
@@ -576,13 +576,13 @@ static inline void mem_cgroup_migrate(struct page *old, struct page *new)static inline struct lruvec *mem_cgroup_zone_lruvec (struct zone *zone,struct mem_cgroup *memcg) { -return &zone->lruvec; +return zone_lruvec (zone); }static inline struct lruvec *mem_cgroup_page_lruvec (struct page *page, -struct zone *zone) +struct pglist_data *pgdat) { -return &zone->lruvec; +return &pgdat->lruvec; } static inline bool mm_match_cgroup(struct mm_struct *mm,
include/linux/mm_inline.h +14 -7
@@ -23,25 +23,32 @@ static inline int page_is_file_cache(struct page *page) } static __always_inline void __update_lru_size(struct lruvec *lruvec, -enum lru_list lru,int nr_pages) +enum lru_list lru,enum zone_type zid, +int nr_pages) { -__mod_zone_page_state (lruvec_zone (lruvec),NR_LRU_BASE + lru, nr_pages); +struct pglist_data *pgdat =lruvec_pgdat (lruvec); + +__mod_node_page_state (pgdat,NR_LRU_BASE + lru, nr_pages); +__mod_zone_page_state (&pgdat->node_zones[zid], +NR_ZONE_LRU_BASE + !!is_file_lru (lru), + nr_pages); } static __always_inline void update_lru_size(struct lruvec *lruvec, -enum lru_list lru,int nr_pages) +enum lru_list lru,enum zone_type zid, +int nr_pages) {#ifdef CONFIG_MEMCG -mem_cgroup_update_lru_size (lruvec, lru, nr_pages); +mem_cgroup_update_lru_size (lruvec, lru, zid, nr_pages);#else -__update_lru_size (lruvec, lru, nr_pages); +__update_lru_size (lruvec, lru, zid, nr_pages);#endif } static __always_inline void add_page_to_lru_list(struct page *page,struct lruvec *lruvec,enum lru_list lru) { -update_lru_size (lruvec, lru,hpage_nr_pages (page)); +update_lru_size (lruvec, lru,page_zonenum (page),hpage_nr_pages (page));list_add (&page->lru, &lruvec->lists[lru]); }
@@ -49,7 +56,7 @@ static __always_inline void del_page_from_lru_list(struct page *page, struct lruvec *lruvec, enum lru_list lru) {list_del (&page->lru); -update_lru_size (lruvec, lru, -hpage_nr_pages (page)); +update_lru_size (lruvec, lru,page_zonenum (page), -hpage_nr_pages (page)); }/**
include/linux/mmzone.h +42 -27
148 lines not on this page · raw message
include/linux/swap.h +1 -0
@@ -317,6 +317,7 @@ extern void lru_cache_add_active_or_unevictable(struct page *page,/* linux/mm/vmscan.c */ extern unsigned long zone_reclaimable_pages (struct zone *zone); +extern unsigned long pgdat_reclaimable_pages (struct pglist_data *pgdat);extern unsigned long try_to_free_pages (struct zonelist *zonelist,int order,gfp_t gfp_mask,nodemask_t *mask);extern int __isolate_lru_page (struct page *page,isolate_mode_t mode);
include/linux/vm_event_item.h +5 -5
@@ -26,11 +26,11 @@ enum vm_event_item { PGPGIN, PGPGOUT, PSWPIN, PSWPOUT,PGFREE ,PGACTIVATE ,PGDEACTIVATE ,PGFAULT ,PGMAJFAULT ,PGLAZYFREED , -FOR_ALL_ZONES (PGREFILL ), -FOR_ALL_ZONES (PGSTEAL_KSWAPD ), -FOR_ALL_ZONES (PGSTEAL_DIRECT ), -FOR_ALL_ZONES (PGSCAN_KSWAPD ), -FOR_ALL_ZONES (PGSCAN_DIRECT ), +PGREFILL , +PGSTEAL_KSWAPD , +PGSTEAL_DIRECT , +PGSCAN_KSWAPD , +PGSCAN_DIRECT ,PGSCAN_DIRECT_THROTTLE , #ifdef CONFIG_NUMA PGSCAN_ZONE_RECLAIM_FAILED,
include/linux/vmstat.h +17 -0
@@ -184,6 +184,23 @@ static inline unsigned long zone_page_state_snapshot(struct zone *zone,return x; } +static inline unsigned long node_page_state_snapshot (pg_data_t *pgdat, +enum zone_stat_item item) +{ +long x =atomic_long_read (&pgdat->vm_stat[item]); + +#ifdef CONFIG_SMP +int cpu; +for_each_online_cpu (cpu) + x +=per_cpu_ptr (pgdat->per_cpu_nodestats, cpu)->vm_node_stat_diff[item]; + +if (x <0 ) + x =0 ; +#endif +return x; +} + +#ifdef CONFIG_NUMA extern unsigned long sum_zone_node_page_state (int node,enum zone_stat_item item);
include/trace/events/vmscan.h +5 -7
@@ -352,15 +352,14 @@ TRACE_EVENT(mm_vmscan_writepage, TRACE_EVENT(mm_vmscan_lru_shrink_inactive, - TP_PROTO(struct zone *zone, + TP_PROTO(int nid, unsigned long nr_scanned, unsigned long nr_reclaimed, int priority, int file), - TP_ARGS(zone, nr_scanned, nr_reclaimed, priority, file), + TP_ARGS(nid, nr_scanned, nr_reclaimed, priority, file), TP_STRUCT__entry( __field(int, nid) - __field(int, zid) __field(unsigned long, nr_scanned) __field(unsigned long, nr_reclaimed) __field(int, priority)
@@ -368,16 +367,15 @@ TRACE_EVENT(mm_vmscan_lru_shrink_inactive, ), TP_fast_assign( - __entry->nid = zone_to_nid(zone); - __entry->zid =zone_idx (zone); + __entry->nid = nid; __entry->nr_scanned = nr_scanned; __entry->nr_reclaimed = nr_reclaimed; __entry->priority = priority; __entry->reclaim_flags =trace_shrink_flags (file); ), -TP_printk ("nid=%d zid=%d nr_scanned=%ld nr_reclaimed=%ld priority=%d flags=%s" , - __entry->nid, __entry->zid, +TP_printk ("nid=%d nr_scanned=%ld nr_reclaimed=%ld priority=%d flags=%s" , + __entry->nid, __entry->nr_scanned, __entry->nr_reclaimed, __entry->priority,show_reclaim_flags (__entry->reclaim_flags))
kernel/power/snapshot.c +5 -5
@@ -1525,11 +1525,11 @@ static unsigned long minimum_image_size(unsigned long saveable)unsigned long size; size =global_page_state (NR_SLAB_RECLAIMABLE ) - +global_page_state (NR_ACTIVE_ANON ) - +global_page_state (NR_INACTIVE_ANON ) - +global_page_state (NR_ACTIVE_FILE ) - +global_page_state (NR_INACTIVE_FILE ) - -global_page_state (NR_FILE_MAPPED ); + +global_node_page_state (NR_ACTIVE_ANON ) + +global_node_page_state (NR_INACTIVE_ANON ) + +global_node_page_state (NR_ACTIVE_FILE ) + +global_node_page_state (NR_INACTIVE_FILE ) + -global_node_page_state (NR_FILE_MAPPED );return saveable <= size ?0 : saveable - size; }
mm/backing-dev.c +8 -7
@@ -982,24 +982,24 @@ long congestion_wait(int sync, long timeout)EXPORT_SYMBOL (congestion_wait);/** -* wait_iff_congested - Conditionally wait for a backing_dev to become uncongested or a zone to complete writes -* @zone: A zone to check if it is heavily congested +* wait_iff_congested - Conditionally wait for a backing_dev to become uncongested or a pgdat to complete writes +* @pgdat: A pgdat to check if it is heavily congested * @sync: SYNC or ASYNC IO * @timeout: timeout in jiffies * * In the event of a congested backing_dev (any backing_dev) and the given -* @zone has experienced recent congestion, this waits for up to @timeout +* @pgdat has experienced recent congestion, this waits for up to @timeout * jiffies for either a BDI to exit congestion of the given @sync queue * or a write to complete. * -* In the absence of zone congestion, cond_resched() is called to yield +* In the absence of pgdat congestion, cond_resched() is called to yield * the processor if necessary but otherwise does not sleep. * * The return value is 0 if the sleep is for the full timeout. Otherwise, * it is the number of jiffies that were still remaining when the function * returned. return_value == timeout implies the function did not sleep. */ -long wait_iff_congested (struct zone *zone,int sync,long timeout) +long wait_iff_congested (struct pglist_data *pgdat,int sync,long timeout) {long ret;unsigned long start = jiffies;
@@ -1008,12 +1008,13 @@ long wait_iff_congested(struct zone *zone, int sync, long timeout)/* * If there is no congestion, or heavy congestion is not being -* encountered in the current zone, yield if necessary instead +* encountered in the current pgdat, yield if necessary instead * of sleeping on the congestion queue */ if (atomic_read (&nr_wb_congested[sync]) ==0 || - !test_bit (ZONE_CONGESTED , &zone->flags)) { + !test_bit (PGDAT_CONGESTED , &pgdat->flags)) {cond_resched (); +/* In case we scheduled, work out time remaining */ ret = timeout - (jiffies - start);if (ret <0 )
mm/compaction.c +9 -9
@@ -647,8 +647,8 @@ static void acct_isolated(struct zone *zone, struct compact_control *cc)list_for_each_entry (page, &cc->migratepages, lru) count[!!page_is_file_cache (page)]++; -mod_zone_page_state (zone,NR_ISOLATED_ANON , count[0 ]); -mod_zone_page_state (zone,NR_ISOLATED_FILE , count[1 ]); +mod_node_page_state (zone->zone_pgdat,NR_ISOLATED_ANON , count[0 ]); +mod_node_page_state (zone->zone_pgdat,NR_ISOLATED_FILE , count[1 ]); }/* Similar to reclaim, but different enough that they don't share logic */
@@ -656,12 +656,12 @@ static bool too_many_isolated(struct zone *zone) {unsigned long active, inactive, isolated; - inactive =zone_page_state (zone,NR_INACTIVE_FILE ) + -zone_page_state (zone,NR_INACTIVE_ANON ); - active =zone_page_state (zone,NR_ACTIVE_FILE ) + -zone_page_state (zone,NR_ACTIVE_ANON ); - isolated =zone_page_state (zone,NR_ISOLATED_FILE ) + -zone_page_state (zone,NR_ISOLATED_ANON ); + inactive =node_page_state (zone->zone_pgdat,NR_INACTIVE_FILE ) + +node_page_state (zone->zone_pgdat,NR_INACTIVE_ANON ); + active =node_page_state (zone->zone_pgdat,NR_ACTIVE_FILE ) + +node_page_state (zone->zone_pgdat,NR_ACTIVE_ANON ); + isolated =node_page_state (zone->zone_pgdat,NR_ISOLATED_FILE ) + +node_page_state (zone->zone_pgdat,NR_ISOLATED_ANON );return isolated > (inactive + active) /2 ; }
@@ -859,7 +859,7 @@ isolate_migratepages_block(struct compact_control *cc, unsigned long low_pfn, } } - lruvec =mem_cgroup_page_lruvec (page, zone); + lruvec =mem_cgroup_page_lruvec (page, zone->zone_pgdat);/* Try isolate the page */ if (__isolate_lru_page (page, isolate_mode) !=0 )
mm/huge_memory.c +3 -3
@@ -2028,7 +2028,7 @@ void __khugepaged_exit(struct mm_struct *mm)static void release_pte_page (struct page *page) {/* 0 stands for page_is_file_cache(page) == false */ -dec_zone_page_state (page,NR_ISOLATED_ANON +0 ); +dec_node_page_state (page,NR_ISOLATED_ANON +0 );unlock_page (page);putback_lru_page (page); }
@@ -2124,7 +2124,7 @@ static int __collapse_huge_page_isolate(struct vm_area_struct *vma, goto out; }/* 0 stands for page_is_file_cache(page) == false */ -inc_zone_page_state (page,NR_ISOLATED_ANON +0 ); +inc_node_page_state (page,NR_ISOLATED_ANON +0 );VM_BUG_ON_PAGE (!PageLocked (page), page);VM_BUG_ON_PAGE (PageLRU (page), page);
@@ -3306,7 +3306,7 @@ static void __split_huge_page(struct page *page, struct list_head *list)/* prevent PageLRU to go away from under us, and freeze lru stats */ spin_lock_irq (zone_lru_lock (zone)); - lruvec =mem_cgroup_page_lruvec (head, zone); + lruvec =mem_cgroup_page_lruvec (head, zone->zone_pgdat);/* complete memcg works before add pages to LRU */ mem_cgroup_split_huge_fixup (head);
mm/internal.h +1 -1
@@ -80,7 +80,7 @@ extern unsigned long highest_memmap_pfn;*/ extern int isolate_lru_page (struct page *page);extern void putback_lru_page (struct page *page); -extern bool zone_reclaimable (struct zone *zone); +extern bool pgdat_reclaimable (struct pglist_data *pgdat);/* * in mm/rmap.c:
mm/memcontrol.c +12 -11
@@ -959,7 +959,7 @@ struct lruvec *mem_cgroup_zone_lruvec(struct zone *zone,struct lruvec *lruvec;if (mem_cgroup_disabled ()) { - lruvec = &zone->lruvec; + lruvec =zone_lruvec (zone); goto out; }
@@ -971,8 +971,8 @@ struct lruvec *mem_cgroup_zone_lruvec(struct zone *zone,* we have to be prepared to initialize lruvec->zone here; * and if offlined then reonlined, we need to reinitialize it. */ -if (unlikely (lruvec->zone != zone)) - lruvec->zone = zone; +if (unlikely (lruvec->pgdat != zone->zone_pgdat)) + lruvec->pgdat = zone->zone_pgdat;return lruvec; }
@@ -985,14 +985,14 @@ struct lruvec *mem_cgroup_zone_lruvec(struct zone *zone,* and putback protocol: the LRU lock must be held, and the page must * either be PageLRU() or the caller must have isolated/allocated it. */ -struct lruvec *mem_cgroup_page_lruvec (struct page *page,struct zone *zone) +struct lruvec *mem_cgroup_page_lruvec (struct page *page,struct pglist_data *pgdat) {struct mem_cgroup_per_zone *mz;struct mem_cgroup *memcg;struct lruvec *lruvec;if (mem_cgroup_disabled ()) { - lruvec = &zone->lruvec; + lruvec = &pgdat->lruvec; goto out; }
@@ -1012,8 +1012,8 @@ struct lruvec *mem_cgroup_page_lruvec(struct page *page, struct zone *zone)* we have to be prepared to initialize lruvec->zone here; * and if offlined then reonlined, we need to reinitialize it. */ -if (unlikely (lruvec->zone != zone)) - lruvec->zone = zone; +if (unlikely (lruvec->pgdat != pgdat)) + lruvec->pgdat = pgdat;return lruvec; }
@@ -1021,6 +1021,7 @@ struct lruvec *mem_cgroup_page_lruvec(struct page *page, struct zone *zone)* mem_cgroup_update_lru_size - account for adding or removing an lru page * @lruvec: mem_cgroup per zone lru vector * @lru: index of lru list the page is sitting on +* @zid: Zone ID of the zone pages have been added to * @nr_pages: positive when adding or negative when removing * * This function must be called under lru_lock, just before a page is added
@@ -1028,14 +1029,14 @@ struct lruvec *mem_cgroup_page_lruvec(struct page *page, struct zone *zone)* so as to allow it to check that lru_size 0 is consistent with list_empty). */ void mem_cgroup_update_lru_size (struct lruvec *lruvec,enum lru_list lru, -int nr_pages) +enum zone_type zid,int nr_pages) {struct mem_cgroup_per_zone *mz;unsigned long *lru_size;long size;bool empty; -__update_lru_size (lruvec, lru, nr_pages); +__update_lru_size (lruvec, lru, zid, nr_pages);if (mem_cgroup_disabled ())return ;
@@ -2111,7 +2112,7 @@ static void lock_page_lru(struct page *page, int *isolated)if (PageLRU (page)) {struct lruvec *lruvec; - lruvec =mem_cgroup_page_lruvec (page, zone); + lruvec =mem_cgroup_page_lruvec (page, zone->zone_pgdat);ClearPageLRU (page);del_page_from_lru_list (page, lruvec,page_lru (page)); *isolated =1 ;
@@ -2126,7 +2127,7 @@ static void unlock_page_lru(struct page *page, int isolated)if (isolated) {struct lruvec *lruvec; - lruvec =mem_cgroup_page_lruvec (page, zone); + lruvec =mem_cgroup_page_lruvec (page, zone->zone_pgdat);VM_BUG_ON_PAGE (PageLRU (page), page);SetPageLRU (page);add_page_to_lru_list (page, lruvec,page_lru (page));
mm/memory-failure.c +2 -2
@@ -1663,7 +1663,7 @@ static int __soft_offline_page(struct page *page, int flags)put_hwpoison_page (page);if (!ret) {LIST_HEAD (pagelist); -inc_zone_page_state (page,NR_ISOLATED_ANON + +inc_node_page_state (page,NR_ISOLATED_ANON +page_is_file_cache (page));list_add (&page->lru, &pagelist); ret = migrate_pages(&pagelist, new_page, NULL, MPOL_MF_MOVE_ALL,
@@ -1671,7 +1671,7 @@ static int __soft_offline_page(struct page *page, int flags)if (ret) {if (!list_empty (&pagelist)) {list_del (&page->lru); -dec_zone_page_state (page,NR_ISOLATED_ANON + +dec_node_page_state (page,NR_ISOLATED_ANON +page_is_file_cache (page));putback_lru_page (page); }
mm/memory_hotplug.c +1 -1
@@ -1586,7 +1586,7 @@ do_migrate_range(unsigned long start_pfn, unsigned long end_pfn)put_page (page);list_add_tail (&page->lru, &source); move_pages--; -inc_zone_page_state (page,NR_ISOLATED_ANON + +inc_node_page_state (page,NR_ISOLATED_ANON +page_is_file_cache (page)); }else {
mm/mempolicy.c +1 -1
@@ -962,7 +962,7 @@ static void migrate_page_add(struct page *page, struct list_head *pagelist,if ((flags &MPOL_MF_MOVE_ALL ) ||page_mapcount (page) ==1 ) {if (!isolate_lru_page (page)) {list_add_tail (&page->lru, pagelist); -inc_zone_page_state (page,NR_ISOLATED_ANON + +inc_node_page_state (page,NR_ISOLATED_ANON +page_is_file_cache (page)); } }
mm/migrate.c +11 -10
@@ -168,7 +168,7 @@ void putback_movable_pages(struct list_head *l)continue ; }list_del (&page->lru); -dec_zone_page_state (page,NR_ISOLATED_ANON + +dec_node_page_state (page,NR_ISOLATED_ANON +page_is_file_cache (page));/* * We isolated non-lru movable page so here we can use
@@ -1117,7 +1117,7 @@ static ICE_noinline int unmap_and_move(new_page_t get_new_page,* restored. */ list_del (&page->lru); -dec_zone_page_state (page,NR_ISOLATED_ANON + +dec_node_page_state (page,NR_ISOLATED_ANON +page_is_file_cache (page)); }
@@ -1458,7 +1458,7 @@ static int do_move_page_to_node_array(struct mm_struct *mm, err =isolate_lru_page (page);if (!err) {list_add_tail (&page->lru, &pagelist); -inc_zone_page_state (page,NR_ISOLATED_ANON + +inc_node_page_state (page,NR_ISOLATED_ANON +page_is_file_cache (page)); } put_and_set:
@@ -1724,15 +1724,16 @@ static bool migrate_balanced_pgdat(struct pglist_data *pgdat, unsigned long nr_migrate_pages) { int z; + + if (!pgdat_reclaimable(pgdat)) + return false; + for (z = pgdat->nr_zones - 1; z >= 0; z--) { struct zone *zone = pgdat->node_zones + z; if (!populated_zone(zone)) continue; - if (!zone_reclaimable(zone)) - continue; - /* Avoid waking kswapd by allocating pages_to_migrate pages. */ if (!zone_watermark_ok(zone, 0, high_wmark_pages(zone) +
@@ -1826,7 +1827,7 @@ static int numamigrate_isolate_page(pg_data_t *pgdat, struct page *page) } page_lru =page_is_file_cache (page); -mod_zone_page_state (page_zone (page),NR_ISOLATED_ANON + page_lru, +mod_node_page_state (page_pgdat (page),NR_ISOLATED_ANON + page_lru,hpage_nr_pages (page));/*
@@ -1884,7 +1885,7 @@ int migrate_misplaced_page(struct page *page, struct vm_area_struct *vma,if (nr_remaining) {if (!list_empty (&migratepages)) {list_del (&page->lru); -dec_zone_page_state (page,NR_ISOLATED_ANON + +dec_node_page_state (page,NR_ISOLATED_ANON +page_is_file_cache (page));putback_lru_page (page); }
@@ -1977,7 +1978,7 @@ int migrate_misplaced_transhuge_page(struct mm_struct *mm,/* Retake the callers reference and putback on LRU */ get_page (page);putback_lru_page (page); -mod_zone_page_state (page_zone (page), +mod_node_page_state (page_pgdat (page),NR_ISOLATED_ANON + page_lru, -HPAGE_PMD_NR ); goto out_unlock;
@@ -2029,7 +2030,7 @@ int migrate_misplaced_transhuge_page(struct mm_struct *mm,count_vm_events (PGMIGRATE_SUCCESS ,HPAGE_PMD_NR );count_vm_numa_events (NUMA_PAGE_MIGRATE ,HPAGE_PMD_NR ); -mod_zone_page_state (page_zone (page), +mod_node_page_state (page_pgdat (page),NR_ISOLATED_ANON + page_lru, -HPAGE_PMD_NR );return isolated;
mm/mlock.c +1 -1
@@ -103,7 +103,7 @@ static bool __munlock_isolate_lru_page(struct page *page, bool getpage)if (PageLRU (page)) {struct lruvec *lruvec; - lruvec =mem_cgroup_page_lruvec (page,page_zone (page)); + lruvec =mem_cgroup_page_lruvec (page,page_pgdat (page));if (getpage)get_page (page);ClearPageLRU (page);
mm/page-writeback.c +4 -4
@@ -285,8 +285,8 @@ static unsigned long zone_dirtyable_memory(struct zone *zone)*/ nr_pages -=min (nr_pages, zone->totalreserve_pages); - nr_pages +=zone_page_state (zone,NR_INACTIVE_FILE ); - nr_pages +=zone_page_state (zone,NR_ACTIVE_FILE ); + nr_pages +=node_page_state (zone->zone_pgdat,NR_INACTIVE_FILE ); + nr_pages +=node_page_state (zone->zone_pgdat,NR_ACTIVE_FILE );return nr_pages; }
@@ -348,8 +348,8 @@ static unsigned long global_dirtyable_memory(void)*/ x -=min (x, totalreserve_pages); - x +=global_page_state (NR_INACTIVE_FILE ); - x +=global_page_state (NR_ACTIVE_FILE ); + x +=global_node_page_state (NR_INACTIVE_FILE ); + x +=global_node_page_state (NR_ACTIVE_FILE );if (!vm_highmem_is_dirtyable) x -=highmem_dirtyable_memory (x);
mm/page_alloc.c +38 -32
138 lines not on this page · raw message
mm/swap.c +28 -28
129 lines not on this page · raw message
mm/vmscan.c +131 -95
580 lines not on this page · raw message
mm/vmstat.c +25 -22
104 lines not on this page · raw message
mm/workingset.c +2 -2
@@ -353,8 +353,8 @@ static unsigned long count_shadow_nodes(struct shrinker *shrinker, pages =mem_cgroup_node_nr_lru_pages (sc->memcg, sc->nid,LRU_ALL_FILE ); }else { - pages =sum_zone_node_page_state (sc->nid,NR_ACTIVE_FILE ) + -sum_zone_node_page_state (sc->nid,NR_INACTIVE_FILE ); + pages =node_page_state (NODE_DATA (sc->nid),NR_ACTIVE_FILE ) + +node_page_state (NODE_DATA (sc->nid),NR_INACTIVE_FILE ); }/*
Signature · 7 lines
2.6.4 -- 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>