mm: fix passing active page into shrink_page_list
Currently, per-process reclaim calls shrink_page_list several times with zone loop. However, it's pointless that passing pages failed to reclaim in earlier trial. More severe problem is shrink_page_list can mark victim pages as PG_active so next trial of shrink_page_list with those PG_active page in the loop can warn like below. Remove the unncessary loop with zone iterator and just pass NULL as zone argument in shrink_page_list. The shrink_page_list doesn't rely on zone except writeback throttling logic in memory pressure. Since writeback throttling work with global reclaim, per-process reclaim doesn't matter. 02-02 19:07:31.511 1000 1729 1729 F BUG : Bad page state in process CompactionThrea pfn:cd3fa 02-02 19:07:31.511 1000 1729 1729 F page : 0000000000000000 count:0 mapcount:0 mapping:0000000000000000 index:0xbf3a7 02-02 19:07:31.511 1000 1729 1729 F flags : 0x40048(uptodate|active|swapbacked) 02-02 19:07:31.511 1000 1729 1729 F : page dumped because: PAGE_FLAGS_CHECK_AT_FREE flag(s) set 02-02 19:07:31.511 1000 1729 1729 F : bad because of flags: 02-02 19:07:31.511 1000 1729 1729 F flags : 0x40(active) 02-02 19:07:31.511 1000 1729 1729 W : Modules linked in: wlan(C) lge_battery sw49408 ftm4 touch_core_base 02-02 19:07:31.511 1000 1729 1729 W : CPU: 6 PID: 1729 Comm: CompactionThrea Tainted: G B WC 4.4.172-g8be3181903c2 #1 02-02 19:07:31.511 1000 1729 1729 W Hardware name: Qualcomm Technologies, Inc. MSM8998 v2.1 (DT) 02-02 19:07:31.511 1000 [PHONE_NUMBER] W Call trace: 02-02 19:07:31.511 1000 1729 1729 W : [<ffffff91b1e8ab74>] dump_backtrace+0x0/0x3e4 02-02 19:07:31.511 1000 1729 1729 W : [<ffffff91b1e8ab6c>] show_stack+0x14/0x1c 02-02 19:07:31.511 1000 1729 1729 W : [<ffffff91b2195c38>] dump_stack+0xcc/0x104 02-02 19:07:31.511 1000 1729 1729 W : [<ffffff91b1f9e8b0>] bad_page+0xe8/0x11c 02-02 19:07:31.511 1000 1729 1729 W : [<ffffff91b1f9a450>] free_pages_prepare+0x264/0x274 02-02 19:07:31.511 1000 1729 1729 W : [<ffffff91b1f9a008>] free_hot_cold_page+0x38/0x21c 02-02 19:07:31.511 1000 1729 1729 W : [<ffffff91b1f9a7f8>] free_hot_cold_page_list+0xec/0x110 02-02 19:07:31.511 1000 1729 1729 W : [<ffffff91b1fa90cc>] shrink_page_list+0x988/0xa90 02-02 19:07:31.511 1000 1729 1729 W : [<ffffff91b1fa93f4>] reclaim_pages+0x220/0x30c 02-02 19:07:31.511 1000 1729 1729 W : [<ffffff91b206029c>] reclaim_pmd_range+0x13c/0x218 02-02 19:07:31.511 1000 1729 1729 W : [<ffffff91b1fd5490>] __walk_page_range+0xf4/0x204 02-02 19:07:31.511 1000 1729 1729 W : [<ffffff91b1fd5368>] walk_page_range+0xf8/0x12c 02-02 19:07:31.511 1000 1729 1729 W : [<ffffff91b205f0e0>] reclaim_write+0x1e0/0x244 02-02 19:07:31.511 1000 1729 1729 W : [<ffffff91b1fecda8>] vfs_write+0xd0/0x240 02-02 19:07:31.511 1000 1729 1729 W : [<ffffff91b1fed020>] SyS_write+0x54/0xb4 02-02 19:07:31.511 1000 1729 1729 W : [<ffffff91b1e83b0c>] __sys_trace_return+0x0/0x4 Bug: 123834127 Change-Id: I8ced217f6a2d33983d02bfdf7bad7957c4cf7a18 Signed-off-by: Minchan Kim <minchan@google.com>
This commit is contained in:
13
mm/vmscan.c
13
mm/vmscan.c
@@ -969,7 +969,6 @@ static unsigned long shrink_page_list(struct list_head *page_list,
|
||||
goto keep;
|
||||
|
||||
VM_BUG_ON_PAGE(PageActive(page), page);
|
||||
VM_BUG_ON_PAGE(page_zone(page) != zone, page);
|
||||
|
||||
sc->nr_scanned++;
|
||||
|
||||
@@ -1048,7 +1047,7 @@ static unsigned long shrink_page_list(struct list_head *page_list,
|
||||
/* Case 1 above */
|
||||
if (current_is_kswapd() &&
|
||||
PageReclaim(page) &&
|
||||
test_bit(ZONE_WRITEBACK, &zone->flags)) {
|
||||
(zone && test_bit(ZONE_WRITEBACK, &zone->flags))) {
|
||||
nr_immediate++;
|
||||
goto keep_locked;
|
||||
|
||||
@@ -1133,8 +1132,9 @@ static unsigned long shrink_page_list(struct list_head *page_list,
|
||||
* if many dirty pages have been encountered.
|
||||
*/
|
||||
if (page_is_file_cache(page) &&
|
||||
(!current_is_kswapd() ||
|
||||
!test_bit(ZONE_DIRTY, &zone->flags))) {
|
||||
(!current_is_kswapd() ||
|
||||
!(zone &&
|
||||
test_bit(ZONE_DIRTY, &zone->flags)))) {
|
||||
/*
|
||||
* Immediately reclaim when written back.
|
||||
* Similar in principal to deactivate_page()
|
||||
@@ -1349,12 +1349,9 @@ unsigned long reclaim_pages(struct list_head *page_list)
|
||||
mod_zone_page_state(zone, NR_ISOLATED_FILE, nr_isolated[1][i]);
|
||||
}
|
||||
|
||||
for (i = 0; i < MAX_NR_ZONES; i++) {
|
||||
zone = pgdat->node_zones + i;
|
||||
nr_reclaimed += shrink_page_list(page_list, zone, &sc,
|
||||
nr_reclaimed = shrink_page_list(page_list, NULL, &sc,
|
||||
TTU_UNMAP|TTU_IGNORE_ACCESS,
|
||||
&dummy1, &dummy2, &dummy3, &dummy4, &dummy5, true);
|
||||
}
|
||||
|
||||
while (!list_empty(page_list)) {
|
||||
page = lru_to_page(page_list);
|
||||
|
||||
Reference in New Issue
Block a user