lkml.org 
[lkml]   [2013]   [Dec]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
Subject[PATCH 00/41] percpu: Consistent per cpu operations V1
The kernel has never been audited to ensure that this_cpu operations are
consistently used throughout the kernel. The code generated in many
places can be improved through the use of this_cpu operations (which uses
a segment register for relocation of per cpu offsets instead of
performing address calculations).

The patchset also addresses various consistency issues in general with
the per cpu macros.

A. The semantics of __this_cpu_ptr() differs from this_cpu_ptr only
because checks are skipped. This is typically shown through a raw_
prefix. So this patchset changes the places where __this_cpu_ptr()
is used to raw_cpu_ptr().

B. There has been the long term wish by some that __this_cpu operations
would check for preemption. However, there are cases where preemption
checks need to be skipped. This patchset adds raw_cpu operations that
do not check for preemption and then adds preemption checks to the
__this_cpu operations.

C. The use of __get_cpu_var is always a reference to a percpu variable
that can also be handled via a this_cpu operation. This patchset
replaces all uses of __get_cpu_var with this_cpu operations.

D. We can then use this_cpu RMW operations in various places replacing
sequences of instructions by a single one.

E. The use of this_cpu operations throughout will allow other arches than
x86 to implement optimized references and RMV operations to work with
per cpu local data.

F. The use of this_cpu operations opens up the possibility to
further optimize code that relies on synchronization through
per cpu data.


The patchset works in a couple of stages:

I. Patches 1-12 are patches that simply replace uses of __get_cpu_var
with this_cpu_ptr. They do not depend on any changes to the percpu
code.

II. Patch 13 adds the additional raw_cpu operations and raw_cpu_ptr().
Patch 14 converts the existing __this_cpu_xx_# primitive in the x86
code to raw_cpu_xx_#.

III. Patch 15-17 use the raw_cpu operations in places that would give
us false positives once they are enabled.

IV. Patch 18 adds preemption checks to __this_cpu operations to allow
checking if preemption is properly disabled when these functions
are used.

V. Patches 19-39 are conversion patches that use this_cpu operations
in various kernel subsystems/drivers or arch code.

VI. Patches 41/42 remove no longer used functions (__this_cpu_ptr
and __get_cpu_var). These should only be applied after all the
conversion patches have made it and after we have done additonal
passes through the kernel to ensure that none of the uses of these
functions remain.



\
 
 \ /
  Last update: 2013-12-04 01:41    [W:0.550 / U:0.484 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site