最新的内核已经pcp只有一个了 struct per_cpu_pageset { struct per_cpu_pages pcp; s8 stat_threshold; s8 vm_stat_diff[NR_VM_ZONE_STAT_ITEMS]; } ____cacheline_aligned_in_smp; struct per_cpu_pages { int count; /* number of pages in the list */ int high; /* high watermark, emptying needed */ int batch; /* chunk size for buddy add/remove */ /* Lists of pages, one per migrate type stored on the pcp-lists */ struct list_head lists[MIGRATE_PCPTYPES]; }; #define MIGRATE_PCPTYPES 3 /* the number of types on the pcp lists */ static void setup_pageset(struct per_cpu_pageset *p, unsigned long batch) { struct per_cpu_pages *pcp; int migratetype; memset(p, 0, sizeof(*p)); pcp = &p->pcp; pcp->count = 0; pcp->high = 6 * batch; pcp->batch = max(1UL, 1 * batch); for (migratetype = 0; migratetype < MIGRATE_PCPTYPES; migratetype++) INIT_LIST_HEAD(&pcp->lists[migratetype]); } batch 这个参数是这样计算出来的 static int zone_batchsize(struct zone *zone) { #ifdef CONFIG_MMU int batch; batch = zone->present_pages / 1024; if (batch * PAGE_SIZE > 512 * 1024) batch = (512 * 1024) / PAGE_SIZE; batch /= 4; /* We effectively *= 4 below */ if (batch < 1) batch = 1; batch = rounddown_pow_of_two(batch + batch/2) - 1; return batch; #else return 0; #endif }