lkml.org 
[lkml]   [2014]   [Feb]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH 1/2] mm/vmscan: restore sc->gfp_mask after promoting it to __GFP_HIGHMEM
From
On Fri, Feb 14, 2014 at 12:10 AM, Rik van Riel <riel@redhat.com> wrote:
> On 02/12/2014 09:39 PM, Weijie Yang wrote:
>
>> --- a/mm/vmscan.c
>> +++ b/mm/vmscan.c
>> @@ -2298,14 +2298,17 @@ static bool shrink_zones(struct zonelist *zonelist, struct scan_control *sc)
>> unsigned long nr_soft_reclaimed;
>> unsigned long nr_soft_scanned;
>> bool aborted_reclaim = false;
>> + bool promoted_mask = false;
>>
>> /*
>> * If the number of buffer_heads in the machine exceeds the maximum
>> * allowed level, force direct reclaim to scan the highmem zone as
>> * highmem pages could be pinning lowmem pages storing buffer_heads
>> */
>> - if (buffer_heads_over_limit)
>> + if (buffer_heads_over_limit) {
>
> It took me a minute to figure out why you are doing things this way,
> so maybe this could use a comment, or maybe it could be done in a
> simpler way, by simply saving and restoring the original mask?
> orig_mask = sc->gfp_mask;

Yes, you are right. This simpler way is better. I will turn to it in
V2 resend patch.

Thanks!

>> + promoted_mask = !(sc->gfp_mask & __GFP_HIGHMEM);
>> sc->gfp_mask |= __GFP_HIGHMEM;
>> + }
>>
>> for_each_zone_zonelist_nodemask(zone, z, zonelist,
>> gfp_zone(sc->gfp_mask), sc->nodemask) {
>> @@ -2354,6 +2357,9 @@ static bool shrink_zones(struct zonelist *zonelist, struct scan_control *sc)
>> shrink_zone(zone, sc);
>> }
>>
>> + if (promoted_mask)
> sc->gfp_mask = orig_mask;
>
>> + sc->gfp_mask &= ~__GFP_HIGHMEM;
>> +
>> return aborted_reclaim;
>> }
>>
>>
>
>
> --
> All rights reversed


\
 
 \ /
  Last update: 2014-02-14 05:21    [W:1.152 / U:0.008 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site