From ffd490388c252eea9ab8551576bd2c5509618a13 Mon Sep 17 00:00:00 2001 From: Paul Jackson Date: Fri, 24 Mar 2006 03:16:11 -0800 Subject: [PATCH] --- yaml --- r: 23423 b: refs/heads/master c: 151a44202d097ae8b1bbaa6d8d2f97df30e3cd1e h: refs/heads/master i: 23421: e430b7c9525e58fc0881b65129fbecbe3d882d51 23419: 63341ebc2ef9f6b088155d426298d7ec7dd42d41 23415: 4e729c6ecc03bd295b358f466c4cb25620f64555 23407: b4bcaaa4202fca262597e6dffd2a9dc29cb4c921 23391: 931460a3765cf3da4557747e790d311f7260d2c2 23359: 2e1d20dfe89a905bd01b7432ca3fba9a58dc9dd8 23295: 5aa4f19cf969088ec4ddf035d842a69fb6ece6a0 v: v3 --- [refs] | 2 +- trunk/kernel/cpuset.c | 19 +++++++++++-------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/[refs] b/[refs] index af9bc0d66d6a..dbf47710ba5b 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 8488bc359d674baf710992e4b641513ea5ebd212 +refs/heads/master: 151a44202d097ae8b1bbaa6d8d2f97df30e3cd1e diff --git a/trunk/kernel/cpuset.c b/trunk/kernel/cpuset.c index bc4131141230..702928664f42 100644 --- a/trunk/kernel/cpuset.c +++ b/trunk/kernel/cpuset.c @@ -149,7 +149,7 @@ static inline int is_spread_slab(const struct cpuset *cs) } /* - * Increment this atomic integer everytime any cpuset changes its + * Increment this integer everytime any cpuset changes its * mems_allowed value. Users of cpusets can track this generation * number, and avoid having to lock and reload mems_allowed unless * the cpuset they're using changes generation. @@ -163,8 +163,11 @@ static inline int is_spread_slab(const struct cpuset *cs) * on every visit to __alloc_pages(), to efficiently check whether * its current->cpuset->mems_allowed has changed, requiring an update * of its current->mems_allowed. + * + * Since cpuset_mems_generation is guarded by manage_mutex, + * there is no need to mark it atomic. */ -static atomic_t cpuset_mems_generation = ATOMIC_INIT(1); +static int cpuset_mems_generation; static struct cpuset top_cpuset = { .flags = ((1 << CS_CPU_EXCLUSIVE) | (1 << CS_MEM_EXCLUSIVE)), @@ -877,7 +880,7 @@ static int update_nodemask(struct cpuset *cs, char *buf) mutex_lock(&callback_mutex); cs->mems_allowed = trialcs.mems_allowed; - cs->mems_generation = atomic_inc_return(&cpuset_mems_generation); + cs->mems_generation = cpuset_mems_generation++; mutex_unlock(&callback_mutex); set_cpuset_being_rebound(cs); /* causes mpol_copy() rebind */ @@ -1270,11 +1273,11 @@ static ssize_t cpuset_common_file_write(struct file *file, const char __user *us break; case FILE_SPREAD_PAGE: retval = update_flag(CS_SPREAD_PAGE, cs, buffer); - cs->mems_generation = atomic_inc_return(&cpuset_mems_generation); + cs->mems_generation = cpuset_mems_generation++; break; case FILE_SPREAD_SLAB: retval = update_flag(CS_SPREAD_SLAB, cs, buffer); - cs->mems_generation = atomic_inc_return(&cpuset_mems_generation); + cs->mems_generation = cpuset_mems_generation++; break; case FILE_TASKLIST: retval = attach_task(cs, buffer, &pathbuf); @@ -1823,7 +1826,7 @@ static long cpuset_create(struct cpuset *parent, const char *name, int mode) atomic_set(&cs->count, 0); INIT_LIST_HEAD(&cs->sibling); INIT_LIST_HEAD(&cs->children); - cs->mems_generation = atomic_inc_return(&cpuset_mems_generation); + cs->mems_generation = cpuset_mems_generation++; fmeter_init(&cs->fmeter); cs->parent = parent; @@ -1913,7 +1916,7 @@ int __init cpuset_init_early(void) struct task_struct *tsk = current; tsk->cpuset = &top_cpuset; - tsk->cpuset->mems_generation = atomic_inc_return(&cpuset_mems_generation); + tsk->cpuset->mems_generation = cpuset_mems_generation++; return 0; } @@ -1932,7 +1935,7 @@ int __init cpuset_init(void) top_cpuset.mems_allowed = NODE_MASK_ALL; fmeter_init(&top_cpuset.fmeter); - top_cpuset.mems_generation = atomic_inc_return(&cpuset_mems_generation); + top_cpuset.mems_generation = cpuset_mems_generation++; init_task.cpuset = &top_cpuset;