History

percpu: set PCPU_BITMAP_BLOCK_SIZE to PAGE_SIZE

Previously, block size was flexible based on the constraint that the GCD(PCPU_BITMAP_BLOCK_SIZE, PAGE_SIZE) > 1. However, this carried the overhead that keeping a floating number of populated free pages required scanning over the free regions of a chunk. Setting the block size to be fixed at PAGE_SIZE lets us know when an empty page becomes used as we will break a full contig_hint of a block. This means we no longer have to scan the whole chunk upon breaking a contig_hint which empty page management piggybacked off. A later patch takes advantage of this to optimize the allocation path by only scanning forward using the scan_hint introduced later too.

Dennis Zhou committed 7 years ago

Commit b239f7d1 parent 8744d853 files · +48 −76Browse files

Showing the changes to include/linux (1 of 3 files). Show all

Unified · Split

include/linux/percpu.h+3−9
@@ -26,16 +26,10 @@ · 25 unmodified lines
2626 #define PCPU_MIN_ALLOC_SHIFT 2
2727 #define PCPU_MIN_ALLOC_SIZE (1 << PCPU_MIN_ALLOC_SHIFT)
2828
29−/* number of bits per page, used to trigger a scan if blocks are > PAGE_SIZE */
30−#define PCPU_BITS_PER_PAGE (PAGE_SIZE >> PCPU_MIN_ALLOC_SHIFT)
31−
3229 /*
33− * This determines the size of each metadata block. There are several subtle
34− * constraints around this constant. The reserved region must be a multiple of
35− * PCPU_BITMAP_BLOCK_SIZE. Additionally, PCPU_BITMAP_BLOCK_SIZE must be a
36− * multiple of PAGE_SIZE or PAGE_SIZE must be a multiple of
37− * PCPU_BITMAP_BLOCK_SIZE to align with the populated page map. The unit_size
38− * also has to be a multiple of PCPU_BITMAP_BLOCK_SIZE to ensure full blocks.
30+ * The PCPU_BITMAP_BLOCK_SIZE must be the same size as PAGE_SIZE as the
31+ * updating of hints is used to manage the nr_empty_pop_pages in both
32+ * the chunk and globally.
3933 */
4034 #define PCPU_BITMAP_BLOCK_SIZE PAGE_SIZE
4135 #define PCPU_BITMAP_BLOCK_BITS (PCPU_BITMAP_BLOCK_SIZE >> \

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t