Re: Kernel falls apart under light memory pressure (i.e. linking vmlinux)

From: Minchan Kim
Date: Sat May 21 2011 - 10:31:51 EST

On Sat, May 21, 2011 at 9:04 PM, KOSAKI Motohiro
<kosaki.motohiro@xxxxxxxxxxxxxx> wrote:
>> diff --git a/mm/vmscan.c b/mm/vmscan.c
>> index 3f44b81..d1dabc9 100644
>> @@ -1426,8 +1437,13 @@ shrink_inactive_list(unsigned long nr_to_scan,
>> struct zone *zone,
>> Â Â Â Â/* Check if we should syncronously wait for writeback */
>> Â Â Â Âif (should_reclaim_stall(nr_taken, nr_reclaimed, priority, sc)) {
>> + Â Â Â Â Â Â Â unsigned long nr_active, old_nr_scanned;
>> Â Â Â Â Â Â Â Âset_reclaim_mode(priority, sc, true);
>> + Â Â Â Â Â Â Â nr_active = clear_active_flags(&page_list, NULL);
>> + Â Â Â Â Â Â Â count_vm_events(PGDEACTIVATE, nr_active);
>> + Â Â Â Â Â Â Â old_nr_scanned = sc->nr_scanned;
>> Â Â Â Â Â Â Â Ânr_reclaimed += shrink_page_list(&page_list, zone, sc);
>> + Â Â Â Â Â Â Â sc->nr_scanned = old_nr_scanned;
>> Â Â Â Â}
>> Â Â Â Âlocal_irq_disable();
>> I just tested with the attached patch. ÂIt survived dirty_ram
>> and test_mempressure without any problems other than slowness, but
>> when I hit ctrl-c to stop test_mempressure, I got the attached oom.
> Minchan,
> I'm confused now.
> If pages got SetPageActive(), should_reclaim_stall() should never return true.

You're absolutely right.
I missed that so the problem should not happen. :(

Kind regards,
Minchan Kim
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at