Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 93980
b: refs/heads/master
c: dac1d27
h: refs/heads/master
v: v3
  • Loading branch information
Mel Gorman authored and Linus Torvalds committed Apr 28, 2008
1 parent eb868cb commit 2b41b64
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 16 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 9d02dbc8137759e4c2f91db0b7f9c8a1ec2a9276
refs/heads/master: dac1d27bc8d5ca636d3014ecfdf94407031d1970
8 changes: 4 additions & 4 deletions trunk/fs/buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -360,16 +360,16 @@ void invalidate_bdev(struct block_device *bdev)
*/
static void free_more_memory(void)
{
struct zone **zones;
struct zonelist *zonelist;
pg_data_t *pgdat;

wakeup_pdflush(1024);
yield();

for_each_online_pgdat(pgdat) {
zones = pgdat->node_zonelists[gfp_zone(GFP_NOFS)].zones;
if (*zones)
try_to_free_pages(zones, 0, GFP_NOFS);
zonelist = &pgdat->node_zonelists[gfp_zone(GFP_NOFS)];
if (zonelist->zones[0])
try_to_free_pages(zonelist, 0, GFP_NOFS);
}
}

Expand Down
2 changes: 1 addition & 1 deletion trunk/include/linux/swap.h
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ extern int rotate_reclaimable_page(struct page *page);
extern void swap_setup(void);

/* linux/mm/vmscan.c */
extern unsigned long try_to_free_pages(struct zone **zones, int order,
extern unsigned long try_to_free_pages(struct zonelist *zonelist, int order,
gfp_t gfp_mask);
extern unsigned long try_to_free_mem_cgroup_pages(struct mem_cgroup *mem,
gfp_t gfp_mask);
Expand Down
2 changes: 1 addition & 1 deletion trunk/mm/page_alloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1569,7 +1569,7 @@ __alloc_pages(gfp_t gfp_mask, unsigned int order,
reclaim_state.reclaimed_slab = 0;
p->reclaim_state = &reclaim_state;

did_some_progress = try_to_free_pages(zonelist->zones, order, gfp_mask);
did_some_progress = try_to_free_pages(zonelist, order, gfp_mask);

p->reclaim_state = NULL;
p->flags &= ~PF_MEMALLOC;
Expand Down
21 changes: 12 additions & 9 deletions trunk/mm/vmscan.c
Original file line number Diff line number Diff line change
Expand Up @@ -1246,10 +1246,11 @@ static unsigned long shrink_zone(int priority, struct zone *zone,
* If a zone is deemed to be full of pinned pages then just give it a light
* scan then give up on it.
*/
static unsigned long shrink_zones(int priority, struct zone **zones,
static unsigned long shrink_zones(int priority, struct zonelist *zonelist,
struct scan_control *sc)
{
unsigned long nr_reclaimed = 0;
struct zone **zones = zonelist->zones;
int i;


Expand Down Expand Up @@ -1301,15 +1302,16 @@ static unsigned long shrink_zones(int priority, struct zone **zones,
* holds filesystem locks which prevent writeout this might not work, and the
* allocation attempt will fail.
*/
static unsigned long do_try_to_free_pages(struct zone **zones, gfp_t gfp_mask,
struct scan_control *sc)
static unsigned long do_try_to_free_pages(struct zonelist *zonelist,
gfp_t gfp_mask, struct scan_control *sc)
{
int priority;
int ret = 0;
unsigned long total_scanned = 0;
unsigned long nr_reclaimed = 0;
struct reclaim_state *reclaim_state = current->reclaim_state;
unsigned long lru_pages = 0;
struct zone **zones = zonelist->zones;
int i;

if (scan_global_lru(sc))
Expand All @@ -1333,7 +1335,7 @@ static unsigned long do_try_to_free_pages(struct zone **zones, gfp_t gfp_mask,
sc->nr_scanned = 0;
if (!priority)
disable_swap_token();
nr_reclaimed += shrink_zones(priority, zones, sc);
nr_reclaimed += shrink_zones(priority, zonelist, sc);
/*
* Don't shrink slabs when reclaiming memory from
* over limit cgroups
Expand Down Expand Up @@ -1397,7 +1399,8 @@ static unsigned long do_try_to_free_pages(struct zone **zones, gfp_t gfp_mask,
return ret;
}

unsigned long try_to_free_pages(struct zone **zones, int order, gfp_t gfp_mask)
unsigned long try_to_free_pages(struct zonelist *zonelist, int order,
gfp_t gfp_mask)
{
struct scan_control sc = {
.gfp_mask = gfp_mask,
Expand All @@ -1410,7 +1413,7 @@ unsigned long try_to_free_pages(struct zone **zones, int order, gfp_t gfp_mask)
.isolate_pages = isolate_pages_global,
};

return do_try_to_free_pages(zones, gfp_mask, &sc);
return do_try_to_free_pages(zonelist, gfp_mask, &sc);
}

#ifdef CONFIG_CGROUP_MEM_RES_CTLR
Expand All @@ -1428,11 +1431,11 @@ unsigned long try_to_free_mem_cgroup_pages(struct mem_cgroup *mem_cont,
.mem_cgroup = mem_cont,
.isolate_pages = mem_cgroup_isolate_pages,
};
struct zone **zones;
struct zonelist *zonelist;
int target_zone = gfp_zone(GFP_HIGHUSER_MOVABLE);

zones = NODE_DATA(numa_node_id())->node_zonelists[target_zone].zones;
if (do_try_to_free_pages(zones, sc.gfp_mask, &sc))
zonelist = &NODE_DATA(numa_node_id())->node_zonelists[target_zone];
if (do_try_to_free_pages(zonelist, sc.gfp_mask, &sc))
return 1;
return 0;
}
Expand Down

0 comments on commit 2b41b64

Please sign in to comment.