aboutsummaryrefslogtreecommitdiffstats
path: root/mm/percpu-internal.h
diff options
context:
space:
mode:
authorDennis Zhou <dennis@kernel.org>2019-02-25 13:41:45 -0800
committerDennis Zhou <dennis@kernel.org>2019-03-13 12:25:31 -0700
commit382b88e961c7a4196e01cef3249297583d02d608 (patch)
tree0d1dc78b084265547ec2531b42c6cb3a59a8340e /mm/percpu-internal.h
parentpercpu: set PCPU_BITMAP_BLOCK_SIZE to PAGE_SIZE (diff)
downloadlinux-dev-382b88e961c7a4196e01cef3249297583d02d608.tar.xz
linux-dev-382b88e961c7a4196e01cef3249297583d02d608.zip
percpu: add block level scan_hint
Fragmentation can cause both blocks and chunks to have an early first_firee bit available, but only able to satisfy allocations much later on. This patch introduces a scan_hint to help mitigate some unnecessary scanning. The scan_hint remembers the largest area prior to the contig_hint. If the contig_hint == scan_hint, then scan_hint_start > contig_hint_start. This is necessary for scan_hint discovery when refreshing a block. Signed-off-by: Dennis Zhou <dennis@kernel.org> Reviewed-by: Peng Fan <peng.fan@nxp.com>
Diffstat (limited to 'mm/percpu-internal.h')
-rw-r--r--mm/percpu-internal.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/mm/percpu-internal.h b/mm/percpu-internal.h
index b1739dc06b73..ec58b244545d 100644
--- a/mm/percpu-internal.h
+++ b/mm/percpu-internal.h
@@ -9,8 +9,17 @@
* pcpu_block_md is the metadata block struct.
* Each chunk's bitmap is split into a number of full blocks.
* All units are in terms of bits.
+ *
+ * The scan hint is the largest known contiguous area before the contig hint.
+ * It is not necessarily the actual largest contig hint though. There is an
+ * invariant that the scan_hint_start > contig_hint_start iff
+ * scan_hint == contig_hint. This is necessary because when scanning forward,
+ * we don't know if a new contig hint would be better than the current one.
*/
struct pcpu_block_md {
+ int scan_hint; /* scan hint for block */
+ int scan_hint_start; /* block relative starting
+ position of the scan hint */
int contig_hint; /* contig hint for block */
int contig_hint_start; /* block relative starting
position of the contig hint */