RE: [patch V2 2/5] posix-cpu-timers: Convert the flags to a bitmap
David Laight writes: > From: Thomas Gleixner >> Sent: 21 July 2020 17:11 >> >> Frederic Weisbecker writes: >> > On Thu, Jul 16, 2020 at 10:19:25PM +0200, Thomas Gleixner wrote: >> >> --- a/kernel/time/posix-cpu-timers.c >> >> +++ b/kernel/time/posix-cpu-timers.c >> >> @@ -25,7 +25,7 @@ void posix_cputimers_group_init(struct p >> >> posix_cputimers_init(pct); >> >> if (cpu_limit != RLIM_INFINITY) { >> >> pct->bases[CPUCLOCK_PROF].nextevt = cpu_limit * NSEC_PER_SEC; >> >> - pct->timers_active = true; >> >> + set_bit(CPUTIMERS_ACTIVE, &pct->flags); >> > >> > I guess this one could be __set_bit(). >> >> True :) > > Hmmm... does this code need the bit operations to be atmomic? > If not then an bitmap is completely the wrong thing to be using. Some of it does, otherwise the booleans would have stayed, but I'm reworking parts of it so this might change. Thanks, tglx
RE: [patch V2 2/5] posix-cpu-timers: Convert the flags to a bitmap
From: Thomas Gleixner > Sent: 21 July 2020 17:11 > > Frederic Weisbecker writes: > > On Thu, Jul 16, 2020 at 10:19:25PM +0200, Thomas Gleixner wrote: > >> --- a/kernel/time/posix-cpu-timers.c > >> +++ b/kernel/time/posix-cpu-timers.c > >> @@ -25,7 +25,7 @@ void posix_cputimers_group_init(struct p > >>posix_cputimers_init(pct); > >>if (cpu_limit != RLIM_INFINITY) { > >>pct->bases[CPUCLOCK_PROF].nextevt = cpu_limit * NSEC_PER_SEC; > >> - pct->timers_active = true; > >> + set_bit(CPUTIMERS_ACTIVE, &pct->flags); > > > > I guess this one could be __set_bit(). > > True :) Hmmm... does this code need the bit operations to be atmomic? If not then an bitmap is completely the wrong thing to be using. David - Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)
Re: [patch V2 2/5] posix-cpu-timers: Convert the flags to a bitmap
Frederic Weisbecker writes: > On Thu, Jul 16, 2020 at 10:19:25PM +0200, Thomas Gleixner wrote: >> --- a/kernel/time/posix-cpu-timers.c >> +++ b/kernel/time/posix-cpu-timers.c >> @@ -25,7 +25,7 @@ void posix_cputimers_group_init(struct p >> posix_cputimers_init(pct); >> if (cpu_limit != RLIM_INFINITY) { >> pct->bases[CPUCLOCK_PROF].nextevt = cpu_limit * NSEC_PER_SEC; >> -pct->timers_active = true; >> +set_bit(CPUTIMERS_ACTIVE, &pct->flags); > > I guess this one could be __set_bit(). True :)
Re: [patch V2 2/5] posix-cpu-timers: Convert the flags to a bitmap
On Thu, Jul 16, 2020 at 10:19:25PM +0200, Thomas Gleixner wrote: > --- a/kernel/time/posix-cpu-timers.c > +++ b/kernel/time/posix-cpu-timers.c > @@ -25,7 +25,7 @@ void posix_cputimers_group_init(struct p > posix_cputimers_init(pct); > if (cpu_limit != RLIM_INFINITY) { > pct->bases[CPUCLOCK_PROF].nextevt = cpu_limit * NSEC_PER_SEC; > - pct->timers_active = true; > + set_bit(CPUTIMERS_ACTIVE, &pct->flags); I guess this one could be __set_bit(). > } > }