Do per cpu variables need to be atomic?

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

 



Hello,

Let us say we have a per-cpu data structure as follows:

struct data {
        atomic_t val;
};

Since this is a per-cpu data structure, do I need to have 'val' as
atomic? Or can I just use a normal 'int' for val?

Also are the following the same? If yes, which is preferable?

DEFINE_PER_CPU(struct data, datap);

struct data __percpu *p = &datap;

struct data *p = this_cpu_ptr(&datap);

Thanks,
-- 
Pranith

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies




[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux