Re: [RFC] Introduce atomic_long_t

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Dec 09, 2005 at 10:58:40AM -0800, Christoph Lameter wrote:

> Several counters already have the need to use 64 atomic variables on 64
> bit platforms (see mm_counter_t in sched.h). We have to do ugly ifdefs to
> fall back to 32 bit atomic on 32 bit platforms.
> 
> The VM statistics patch that I am working on will also need to make more 
> extensive use of 64 bit counters when available.
> 
> This patch introduces a new type atomic_long_t that works similar to the c
> "long" type. Its 32 bits on 32 bit platforms and 64 bits on 64 bit platforms.
> 
> The patch uses atomic_long_t to clean up the mess in include/linux/sched.h.
> Implementations for all arches provided but only tested on ia64.
>...

The idea looks good, but the amount of code duplication is ugly.

What about creating an include/linux/atomic.h [1] that contains both 
this new code and other common code like the atomic_t typedef (unless 
there's a good reason why counter isn't volatile on h8300 and v850...).

cu
Adrian

[1] include/asm-generic/atomic.h would be another solution, but for
    an API that should be available on all architectures, include/linux/
    seems to be the more logical place

-- 

       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux