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

From: Minchan Kim
Date: Mon May 23 2011 - 21:34:30 EST


On Tue, May 24, 2011 at 10:19 AM, Andrew Lutomirski <luto@xxxxxxx> wrote:
> On Sun, May 22, 2011 at 7:12 PM, Minchan Kim <minchan.kim@xxxxxxxxx> wrote:
>> Could you test below patch based on vanilla 2.6.38.6?
>> The expect result is that system hang never should happen.
>> I hope this is last test about hang.
>>
>> Thanks.
>>
>> diff --git a/mm/vmscan.c b/mm/vmscan.c
>> index 292582c..1663d24 100644
>> --- a/mm/vmscan.c
>> +++ b/mm/vmscan.c
>> @@ -231,8 +231,11 @@ unsigned long shrink_slab(struct shrink_control *shrink,
>> Â Â Â if (scanned == 0)
>> Â Â Â Â Â Â Â scanned = SWAP_CLUSTER_MAX;
>>
>> - Â Â Â if (!down_read_trylock(&shrinker_rwsem))
>> - Â Â Â Â Â Â Â return 1; Â Â Â /* Assume we'll be able to shrink next time */
>> + Â Â Â if (!down_read_trylock(&shrinker_rwsem)) {
>> + Â Â Â Â Â Â Â /* Assume we'll be able to shrink next time */
>> + Â Â Â Â Â Â Â ret = 1;
>> + Â Â Â Â Â Â Â goto out;
>> + Â Â Â }
>>
>> Â Â Â list_for_each_entry(shrinker, &shrinker_list, list) {
>> Â Â Â Â Â Â Â unsigned long long delta;
>> @@ -286,6 +289,8 @@ unsigned long shrink_slab(struct shrink_control *shrink,
>> Â Â Â Â Â Â Â shrinker->nr += total_scan;
>> Â Â Â }
>> Â Â Â up_read(&shrinker_rwsem);
>> +out:
>> + Â Â Â cond_resched();
>> Â Â Â return ret;
>> Â}
>>
>> @@ -2331,7 +2336,7 @@ static bool sleeping_prematurely(pg_data_t
>> *pgdat, int order, long remaining,
>> Â Â Â Â* must be balanced
>> Â Â Â Â*/
>> Â Â Â if (order)
>> - Â Â Â Â Â Â Â return pgdat_balanced(pgdat, balanced, classzone_idx);
>> + Â Â Â Â Â Â Â return !pgdat_balanced(pgdat, balanced, classzone_idx);
>> Â Â Â else
>> Â Â Â Â Â Â Â return !all_zones_ok;
>> Â}
>
> So far with this patch I can't reproduce the hang or the bogus OOM.
>
> To be completely clear, I have COMPACTION, MIGRATION, and THP off, I'm
> running 2.6.38.6, and I have exactly two patches applied. ÂOne is the
> attached patch and the other is a the fpu.ko/aesni_intel.ko merger
> which I need to get dracut to boot my box.
>
> For fun, I also upgraded to 8GB of RAM and it still works.
>

Hmm. Could you test it with enable thp and 2G RAM?
Isn't it a original test environment?
Please don't change test environment. :)

Thanks for your effort, Andrew.

--
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 http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/