All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paul Jackson <pj@sgi.com>
To: akpm@osdl.org
Cc: steiner@sgi.com, dgc@sgi.com, Simon.Derr@bull.net, ak@suse.de,
	linux-kernel@vger.kernel.org, Paul Jackson <pj@sgi.com>,
	clameter@sgi.com
Subject: [PATCH v2 02/07] cpuset use combined atomic_inc_return calls
Date: Thu, 09 Feb 2006 10:54:24 -0800	[thread overview]
Message-ID: <20060209185424.8596.89333.sendpatchset@jackhammer.engr.sgi.com> (raw)
In-Reply-To: <20060209185418.8596.90838.sendpatchset@jackhammer.engr.sgi.com>

From: Paul Jackson <pj@sgi.com>

Replace pairs of calls to <atomic_inc, atomic_read>, with a single
call atomic_inc_return, saving a few bytes of source and kernel text.

Signed-off-by: Paul Jackson <pj@sgi.com>

---

 kernel/cpuset.c |   11 ++++-------
 1 files changed, 4 insertions(+), 7 deletions(-)

--- 2.6.16-rc1-mm5.orig/kernel/cpuset.c	2006-02-07 16:26:03.511639777 -0800
+++ 2.6.16-rc1-mm5/kernel/cpuset.c	2006-02-07 16:26:43.563843169 -0800
@@ -858,8 +858,7 @@ static int update_nodemask(struct cpuset
 
 	mutex_lock(&callback_mutex);
 	cs->mems_allowed = trialcs.mems_allowed;
-	atomic_inc(&cpuset_mems_generation);
-	cs->mems_generation = atomic_read(&cpuset_mems_generation);
+	cs->mems_generation = atomic_inc_return(&cpuset_mems_generation);
 	mutex_unlock(&callback_mutex);
 
 	set_cpuset_being_rebound(cs);		/* causes mpol_copy() rebind */
@@ -1770,8 +1769,7 @@ static long cpuset_create(struct cpuset 
 	atomic_set(&cs->count, 0);
 	INIT_LIST_HEAD(&cs->sibling);
 	INIT_LIST_HEAD(&cs->children);
-	atomic_inc(&cpuset_mems_generation);
-	cs->mems_generation = atomic_read(&cpuset_mems_generation);
+	cs->mems_generation = atomic_inc_return(&cpuset_mems_generation);
 	fmeter_init(&cs->fmeter);
 
 	cs->parent = parent;
@@ -1861,7 +1859,7 @@ int __init cpuset_init_early(void)
 	struct task_struct *tsk = current;
 
 	tsk->cpuset = &top_cpuset;
-	tsk->cpuset->mems_generation = atomic_read(&cpuset_mems_generation);
+	tsk->cpuset->mems_generation = atomic_inc_return(&cpuset_mems_generation);
 	return 0;
 }
 
@@ -1880,8 +1878,7 @@ int __init cpuset_init(void)
 	top_cpuset.mems_allowed = NODE_MASK_ALL;
 
 	fmeter_init(&top_cpuset.fmeter);
-	atomic_inc(&cpuset_mems_generation);
-	top_cpuset.mems_generation = atomic_read(&cpuset_mems_generation);
+	top_cpuset.mems_generation = atomic_inc_return(&cpuset_mems_generation);
 
 	init_task.cpuset = &top_cpuset;
 

-- 
                          I won't rest till it's the best ...
                          Programmer, Linux Scalability
                          Paul Jackson <pj@sgi.com> 1.650.933.1373

  reply	other threads:[~2006-02-09 18:54 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-02-09 18:54 [PATCH v2 01/07] cpuset cleanup not not operators Paul Jackson
2006-02-09 18:54 ` Paul Jackson [this message]
2006-02-09 19:23   ` [PATCH v2 02/07] cpuset use combined atomic_inc_return calls Michael Buesch
2006-02-09 21:07     ` Paul Jackson
2006-02-09 18:54 ` [PATCH v2 03/07] cpuset memory spread basic implementation Paul Jackson
2006-02-09 18:54 ` [PATCH v2 04/07] cpuset memory spread page cache implementation and hooks Paul Jackson
2006-02-09 18:54 ` [PATCH v2 05/07] cpuset memory spread slab cache implementation Paul Jackson
2006-02-09 18:54 ` [PATCH v2 06/07] cpuset memory spread slab cache optimizations Paul Jackson
2006-02-09 18:54 ` [PATCH v2 07/07] cpuset memory spread slab cache hooks Paul Jackson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060209185424.8596.89333.sendpatchset@jackhammer.engr.sgi.com \
    --to=pj@sgi.com \
    --cc=Simon.Derr@bull.net \
    --cc=ak@suse.de \
    --cc=akpm@osdl.org \
    --cc=clameter@sgi.com \
    --cc=dgc@sgi.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=steiner@sgi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.