Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 35591
b: refs/heads/master
c: 2f6726e
h: refs/heads/master
i:
  35589: 7534de2
  35587: 5e419fa
  35583: f5b7725
v: v3
  • Loading branch information
Christoph Lameter authored and Linus Torvalds committed Sep 26, 2006
1 parent b19ae10 commit 28e83b3
Show file tree
Hide file tree
Showing 4 changed files with 28 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: 4e4785bcf0c8503224fa6c17d8e0228de781bff6
refs/heads/master: 2f6726e54a9410e2e4cee864947c05e954051916
4 changes: 2 additions & 2 deletions trunk/include/linux/mempolicy.h
Original file line number Diff line number Diff line change
Expand Up @@ -162,9 +162,9 @@ extern struct zonelist *huge_zonelist(struct vm_area_struct *vma,
unsigned long addr);
extern unsigned slab_node(struct mempolicy *policy);

extern int policy_zone;
extern enum zone_type policy_zone;

static inline void check_highest_zone(int k)
static inline void check_highest_zone(enum zone_type k)
{
if (k > policy_zone)
policy_zone = k;
Expand Down
11 changes: 8 additions & 3 deletions trunk/mm/mempolicy.c
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ static struct kmem_cache *sn_cache;

/* Highest zone. An specific allocation for a zone below that is not
policied. */
int policy_zone = ZONE_DMA;
enum zone_type policy_zone = ZONE_DMA;

struct mempolicy default_policy = {
.refcnt = ATOMIC_INIT(1), /* never free it */
Expand Down Expand Up @@ -137,7 +137,8 @@ static int mpol_check_policy(int mode, nodemask_t *nodes)
static struct zonelist *bind_zonelist(nodemask_t *nodes)
{
struct zonelist *zl;
int num, max, nd, k;
int num, max, nd;
enum zone_type k;

max = 1 + MAX_NR_ZONES * nodes_weight(*nodes);
zl = kmalloc(sizeof(struct zone *) * max, GFP_KERNEL);
Expand All @@ -148,12 +149,16 @@ static struct zonelist *bind_zonelist(nodemask_t *nodes)
lower zones etc. Avoid empty zones because the memory allocator
doesn't like them. If you implement node hot removal you
have to fix that. */
for (k = policy_zone; k >= 0; k--) {
k = policy_zone;
while (1) {
for_each_node_mask(nd, *nodes) {
struct zone *z = &NODE_DATA(nd)->node_zones[k];
if (z->present_pages > 0)
zl->zones[num++] = z;
}
if (k == 0)
break;
k--;
}
zl->zones[num] = NULL;
return zl;
Expand Down
27 changes: 17 additions & 10 deletions trunk/mm/page_alloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -637,7 +637,8 @@ static int rmqueue_bulk(struct zone *zone, unsigned int order,
*/
void drain_node_pages(int nodeid)
{
int i, z;
int i;
enum zone_type z;
unsigned long flags;

for (z = 0; z < MAX_NR_ZONES; z++) {
Expand Down Expand Up @@ -1158,7 +1159,8 @@ EXPORT_SYMBOL(nr_free_pages);
#ifdef CONFIG_NUMA
unsigned int nr_free_pages_pgdat(pg_data_t *pgdat)
{
unsigned int i, sum = 0;
unsigned int sum = 0;
enum zone_type i;

for (i = 0; i < MAX_NR_ZONES; i++)
sum += pgdat->node_zones[i].free_pages;
Expand Down Expand Up @@ -1358,21 +1360,22 @@ void show_free_areas(void)
* Add all populated zones of a node to the zonelist.
*/
static int __meminit build_zonelists_node(pg_data_t *pgdat,
struct zonelist *zonelist, int nr_zones, int zone_type)
struct zonelist *zonelist, int nr_zones, enum zone_type zone_type)
{
struct zone *zone;

BUG_ON(zone_type >= MAX_NR_ZONES);
zone_type++;

do {
zone_type--;
zone = pgdat->node_zones + zone_type;
if (populated_zone(zone)) {
zonelist->zones[nr_zones++] = zone;
check_highest_zone(zone_type);
}
zone_type--;

} while (zone_type >= 0);
} while (zone_type);
return nr_zones;
}

Expand Down Expand Up @@ -1441,10 +1444,11 @@ static int __meminit find_next_best_node(int node, nodemask_t *used_node_mask)

static void __meminit build_zonelists(pg_data_t *pgdat)
{
int i, j, k, node, local_node;
int i, j, node, local_node;
int prev_node, load;
struct zonelist *zonelist;
nodemask_t used_mask;
enum zone_type k;

/* initialize zonelists */
for (i = 0; i < GFP_ZONETYPES; i++) {
Expand Down Expand Up @@ -1628,7 +1632,7 @@ static void __init calculate_zone_totalpages(struct pglist_data *pgdat,
unsigned long *zones_size, unsigned long *zholes_size)
{
unsigned long realtotalpages, totalpages = 0;
int i;
enum zone_type i;

for (i = 0; i < MAX_NR_ZONES; i++)
totalpages += zones_size[i];
Expand Down Expand Up @@ -2116,7 +2120,7 @@ static void calculate_totalreserve_pages(void)
{
struct pglist_data *pgdat;
unsigned long reserve_pages = 0;
int i, j;
enum zone_type i, j;

for_each_online_pgdat(pgdat) {
for (i = 0; i < MAX_NR_ZONES; i++) {
Expand Down Expand Up @@ -2149,7 +2153,7 @@ static void calculate_totalreserve_pages(void)
static void setup_per_zone_lowmem_reserve(void)
{
struct pglist_data *pgdat;
int j, idx;
enum zone_type j, idx;

for_each_online_pgdat(pgdat) {
for (j = 0; j < MAX_NR_ZONES; j++) {
Expand All @@ -2158,9 +2162,12 @@ static void setup_per_zone_lowmem_reserve(void)

zone->lowmem_reserve[j] = 0;

for (idx = j-1; idx >= 0; idx--) {
idx = j;
while (idx) {
struct zone *lower_zone;

idx--;

if (sysctl_lowmem_reserve_ratio[idx] < 1)
sysctl_lowmem_reserve_ratio[idx] = 1;

Expand Down

0 comments on commit 28e83b3

Please sign in to comment.