Message ID | 1315332049-2604-31-git-send-email-paulmck@linux.vnet.ibm.com |
---|---|
State | Accepted |
Commit | 7eb4f4553ceaa6c64da83c8a71d5a991c0188655 |
Headers | show |
On Tue, Sep 06, 2011 at 11:00:25AM -0700, Paul E. McKenney wrote: > When the ->dynticks field in the rcu_dynticks structure changed to an > atomic_t, its size on 64-bit systems changed from 64 bits to 32 bits. > The local variables in rcu_implicit_dynticks_qs() need to change as > well, hence this commit. If an atomic_t always holds 32-bits, which it appears to, then shouldn't this use u32 rather than unsigned int? - Josh Triplett
On Sun, Oct 16, 2011 at 06:43:50PM -0700, Josh Triplett wrote: > On Tue, Sep 06, 2011 at 11:00:25AM -0700, Paul E. McKenney wrote: > > When the ->dynticks field in the rcu_dynticks structure changed to an > > atomic_t, its size on 64-bit systems changed from 64 bits to 32 bits. > > The local variables in rcu_implicit_dynticks_qs() need to change as > > well, hence this commit. > > If an atomic_t always holds 32-bits, which it appears to, then shouldn't > this use u32 rather than unsigned int? The atomic_t definition is "int", and I need "unsigned int" to avoid integer overflow. But it might make sense to make atomic_t s32, in which case I would use u32. I don't feel very strongly about it either way, because "int" is also defined to be 32 bits. Maybe I should put such a patch forward later on. Thanx, Paul
diff --git a/kernel/rcutree.c b/kernel/rcutree.c index 0c6c30d..ebd18e5 100644 --- a/kernel/rcutree.c +++ b/kernel/rcutree.c @@ -488,11 +488,11 @@ static int dyntick_save_progress_counter(struct rcu_data *rdp) */ static int rcu_implicit_dynticks_qs(struct rcu_data *rdp) { - unsigned long curr; - unsigned long snap; + unsigned int curr; + unsigned int snap; - curr = (unsigned long)atomic_add_return(0, &rdp->dynticks->dynticks); - snap = (unsigned long)rdp->dynticks_snap; + curr = (unsigned int)atomic_add_return(0, &rdp->dynticks->dynticks); + snap = (unsigned int)rdp->dynticks_snap; /* * If the CPU passed through or entered a dynticks idle phase with @@ -502,7 +502,7 @@ static int rcu_implicit_dynticks_qs(struct rcu_data *rdp) * read-side critical section that started before the beginning * of the current RCU grace period. */ - if ((curr & 0x1) == 0 || ULONG_CMP_GE(curr, snap + 2)) { + if ((curr & 0x1) == 0 || UINT_CMP_GE(curr, snap + 2)) { trace_rcu_fqs(rdp->rsp->name, rdp->gpnum, rdp->cpu, "dti"); rdp->dynticks_fqs++; return 1;
When the ->dynticks field in the rcu_dynticks structure changed to an atomic_t, its size on 64-bit systems changed from 64 bits to 32 bits. The local variables in rcu_implicit_dynticks_qs() need to change as well, hence this commit. Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com> --- kernel/rcutree.c | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-)