RFC CPU ops and a rework of per cpu data handling on x86_64
Get series with b4
b4 am [email protected]Versions newest first
- v1 RFC Latest44 of 45 patches 75 repliesIn review
44 of 45 patches are in this archive. The cover letter announces 45.
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/45 | ACPI: Avoid references to impossible processors.drivers/ | +7 | 4 replies | |
| 2/45 | cpu alloc: Simple version of the allocator (static allocations)include/ include/ mm/ +3 more | +280 | 0 replies | |
| 3/45 | Generic CPU operations: Core pieceinclude/ | +156 | 4 replies | |
| 4/45 | cpu alloc: Use in SLUBarch/ include/ mm/ | +52 | 5 replies | |
| 5/45 | cpu alloc: Remove SLUB fieldsinclude/ mm/ | +16 | 0 replies | |
| 6/45 | cpu alloc: page allocator conversioninclude/ include/ mm/ +1 more | +73 | 0 replies | |
| 7/45 | cpu_alloc: Implement dynamically extendable cpu areasinclude/ mm/ mm/ | +300 | 0 replies | |
| 8/45 | cpu alloc: x86 supportarch/ arch/ arch/ +4 more | +64 | 25 replies | |
| 9/45 | cpu alloc: IA64 supportarch/ arch/ include/ | +41 | 0 replies | |
| 10/45 | cpu_alloc: Sparc64 supportarch/ arch/ include/ | +19 | 0 replies | |
| 11/45 | cpu alloc: percpu_counter conversionlib/ | +6 | 0 replies | |
| 12/45 | cpu alloc: crash_notes conversionarch/ drivers/ kernel/ | +4 | 2 replies | |
| 13/45 | cpu alloc: workqueue conversionkernel/ | +14 | 0 replies | |
| 14/45 | cpu alloc: ACPI cstate handling conversionarch/ arch/ drivers/ | +11 | 0 replies | |
| 15/45 | cpu alloc: genhd statistics conversioninclude/ | +6 | 0 replies | |
| 16/45 | cpu alloc: blktrace conversionblock/ | +4 | 0 replies | |
| 17/45 | cpu alloc: SRCUkernel/ kernel/ | +10 | 0 replies | |
| 18/45 | cpu alloc: XFS countersfs/ | +8 | 4 replies | |
| 19/45 | cpu alloc: NFS statisticsfs/ fs/ | +5 | 9 replies | |
| 20/45 | cpu alloc: neigbour statisticsinclude/ net/ | +7 | 0 replies | |
| 21/45 | cpu alloc: tcp statisticsnet/ | +5 | 0 replies | |
| 22/45 | cpu alloc: convert scatchesnet/ net/ | +26 | 0 replies | |
| 23/45 | cpu alloc: dmaengine conversiondrivers/ include/ | +20 | 2 replies | |
| 24/45 | cpu alloc: convert loopback statisticsdrivers/ | +6 | 0 replies | |
| 25/45 | cpu alloc: veth conversiondrivers/ | +5 | 0 replies | |
| 26/45 | cpu alloc: Chelsio statistics conversiondrivers/ | +7 | 0 replies | |
| 27/45 | cpu alloc: convert mib handling to cpu allocinclude/ include/ net/ +5 more | +55 | 0 replies | |
| 28/45 | cpu_alloc: convert network socketsnet/ | +4 | 0 replies | |
| 29/45 | cpu alloc: Use for infinibanddrivers/ | +11 | 0 replies | |
| 30/45 | cpu alloc: Use in the crypto subsystem.crypto/ | +8 | 0 replies | |
| 31/45 | cpu alloc: Remove the allocpercpu functionalityinclude/ mm/ mm/ | +0 | 0 replies | |
| 32/45 | Module handling: Use CPU_xx ops to dynamically allocate countersinclude/ kernel/ | +12 | 0 replies | |
| 33/45 | x86_64: Use CPU ops for nmi alert counterarch/ | +4 | 0 replies | |
| 34/45 | x86_64: Fold percpu area into the cpu area.arch/ arch/ include/ +1 more | +32 | 0 replies | |
| 35/45 | X86_64: Declare pda as per cpu data thereby moving it into the cpu areaarch/ arch/ arch/ +2 more | +17 | 0 replies | |
| 36/45 | X86_64: Place pda first in cpu area.arch/ include/ include/ | +7 | 0 replies | |
| 37/45 | x86_64: Support for fast per cpu operationsarch/ include/ | +266 | 7 replies | |
| 38/45 | x86_64: Remove obsolete per_cpu offset calculationsarch/ include/ | +9 | 0 replies | |
| 39/45 | x86_64: Remove the data_offset field from the pda.arch/ arch/ arch/ +1 more | +3 | 0 replies | |
| 40/45 | x86_64: Provide per_cpu_var definitioninclude/ | +12 | 0 replies | |
| 41/45 | VM statistics: Use CPU opsinclude/ | +4 | 0 replies | |
| 43/45 | x86_64: Add a CPU_OR to support or_pda()include/ include/ | +31 | 0 replies | |
| 44/45 | Remove local_t supportDocumentation/ arch/ include/ +26 more | +1 | 2 replies | |
| 45/45 | Modules: Hack to handle symbols that have a zero valuekernel/ | +8 | 3 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.
Cover letter [rfc 00/45] [RFC] CPU ops and a rework of per cpu data handling on x86_64
This is a pretty early draft stage of the patch. It works on x86_64 only. Its a bit massive so I'd like to have some feedback before proceeding (and maybe some help)?.
The support for other arches was not tested yet.
The patch establishes a new set of cpu operations that allow to exploit single instruction atomicity to allow per cpu variable modifications without disabling/enabling preempt or interrupts and without the need to do an offset calculation in order to determine the location of the variable on the current processor.
It then implements these operations on x86_64 after consolidating per cpu access for allocpercpu, percpu and pda. All per cpu data is then accessible via gs segment override.
This results in a reduction in code size of the kernel and in more efficient operation of per cpu access.
Before:
text data bss dec hex filename
4041907 512371 1302360 5856638 595d7e vmlinux
After (this includes the code added for the cpu allocator!):
text data bss dec hex filename
3861532 527715 1298072 5687319 56c817 vmlinux
On x86_64 the segment override results in the following change for a simple vm counter increment:
Before:
mov %gs:0x8,%rdx Get smp_processor_id mov tableoffset,%rax Get table base incq varoffset(%rax,%rdx,1) Perform the operation with a complex lookup
adding the var offset
An interrupt or a reschedule action can move the execution thread to another processor if interrupt or preempt is not disabled. Then the variable of the wrong processor may be updated in a racy way.
After:
incq %gs:varoffset(%rip)
Single instruction that is safe from interrupts or moving of the execution thread. It will reliably operate on the current processors data area.
Other platforms can also perform address relocation plus atomic ops on a memory location. Exploiting of the atomicity of instructions vs interrupts is therefore possible and will reduce the cpu op processing overhead.
F.e on IA64 we have per cpu virtual mapping of the per cpu area. If we add an offset to the per cpu area variable address then we can guarantee that we always hit the per cpu areas local to a processor.
Other platforms (SPARC?) have registers that can be used to form addresses. If the cpu area address is in one of those then atomic per cpu modifications can be generated for those platforms in the same way.
Slub best performance in the fast fastpath goes from 47 cycles to 41 cycles through the use of the segment override.