Michael Ellerman <mpe@xxxxxxxxxxxxxx> writes: > Michal Hocko <mhocko@xxxxxxxxxx> writes: >> On Tue 10-10-17 23:05:08, Michael Ellerman wrote: >>> Michal Hocko <mhocko@xxxxxxxxxx> writes: >>> > From: Michal Hocko <mhocko@xxxxxxxx> >>> > Memory offlining can fail just too eagerly under a heavy memory pressure. >>> > >>> > [ 5410.336792] page:ffffea22a646bd00 count:255 mapcount:252 mapping:ffff88ff926c9f38 index:0x3 >>> > [ 5410.336809] flags: 0x9855fe40010048(uptodate|active|mappedtodisk) >>> > [ 5410.336811] page dumped because: isolation failed >>> > [ 5410.336813] page->mem_cgroup:ffff8801cd662000 >>> > [ 5420.655030] memory offlining [mem 0x18b580000000-0x18b5ffffffff] failed >>> > >>> > Isolation has failed here because the page is not on LRU. Most probably >>> > because it was on the pcp LRU cache or it has been removed from the LRU >>> > already but it hasn't been freed yet. In both cases the page doesn't look >>> > non-migrable so retrying more makes sense. >>> >>> This breaks offline for me. >>> >>> Prior to this commit: >>> /sys/devices/system/memory/memory0# time echo 0 > online >>> -bash: echo: write error: Device or resource busy >>> >>> real 0m0.001s >>> user 0m0.000s >>> sys 0m0.001s >>> >>> After: >>> /sys/devices/system/memory/memory0# time echo 0 > online >>> -bash: echo: write error: Device or resource busy >>> >>> real 2m0.009s >>> user 0m0.000s >>> sys 1m25.035s >>> >>> There's no way that block can be removed, it contains the kernel text, >>> so it should instantly fail - which it used to. >> >> OK, that means that start_isolate_page_range should have failed but it >> hasn't for some reason. I strongly suspect has_unmovable_pages is doing >> something wrong. Is the kernel text marked somehow? E.g. PageReserved? > > I'm not sure how the text is marked, will have to dig into that. Yeah it's reserved: $ grep __init_begin /proc/kallsyms c000000000d70000 T __init_begin $ ./page-types -r -a 0x0,0xd7 flags page-count MB symbolic-flags long-symbolic-flags 0x0000000100000000 215 13 __________________________r_______________ reserved total 215 13 I added some printks, we're getting EBUSY from do_migrate_range(pfn, end_pfn). So we seem to just have an infinite loop: repeat: /* start memory hot removal */ ret = -EINTR; if (signal_pending(current)) goto failed_removal; cond_resched(); lru_add_drain_all_cpuslocked(); drain_all_pages(zone); pfn = scan_movable_pages(start_pfn, end_pfn); if (pfn) { /* We have movable pages */ ret = do_migrate_range(pfn, end_pfn); printk_ratelimited("memory-hotplug: migrate range returned %ld\n", ret); goto repeat; } eg: memory-hotplug: migrate range returned -16 memory-hotplug: migrate range returned -16 memory-hotplug: migrate range returned -16 memory-hotplug: migrate range returned -16 memory-hotplug: migrate range returned -16 memory-hotplug: migrate range returned -16 memory-hotplug: migrate range returned -16 memory-hotplug: migrate range returned -16 memory-hotplug: migrate range returned -16 memory-hotplug: migrate range returned -16 __offline_pages: 354031 callbacks suppressed memory-hotplug: migrate range returned -16 memory-hotplug: migrate range returned -16 memory-hotplug: migrate range returned -16 memory-hotplug: migrate range returned -16 memory-hotplug: migrate range returned -16 memory-hotplug: migrate range returned -16 memory-hotplug: migrate range returned -16 memory-hotplug: migrate range returned -16 memory-hotplug: migrate range returned -16 memory-hotplug: migrate range returned -16 __offline_pages: 355794 callbacks suppressed cheers -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@xxxxxxxxx. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"dont@xxxxxxxxx"> email@xxxxxxxxx </a>