Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1695258

[PATCH v2 01/23] percpu: setup_first_chunk enforce dynamic region must exist

From Dennis Zhou <dennisz@fb.com>
Newsgroups linux.kernel
Subject [PATCH v2 01/23] percpu: setup_first_chunk enforce dynamic region must exist
Date 2017-07-25 01:20 +0200
Message-ID <u6UNP-3md-5@gated-at.bofh.it> (permalink)
References <u6UE9-3ig-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: "Dennis Zhou (Facebook)" <dennisszhou@gmail.com>

The first chunk is handled as a special case as it is composed of the
static, reserved, and dynamic regions. The code handles each case
individually. The next several patches will merge these code paths and
lay the foundation for the bitmap allocator.

This patch modifies logic to enforce that a dynamic region exists and
changes the area map to account for that. This brings the logic closer
to the dynamic chunk's init logic.

Signed-off-by: Dennis Zhou <dennisszhou@gmail.com>
---
 mm/percpu.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/mm/percpu.c b/mm/percpu.c
index 29244fb..3602d41 100644
--- a/mm/percpu.c
+++ b/mm/percpu.c
@@ -1598,6 +1598,7 @@ int __init pcpu_setup_first_chunk(const struct pcpu_alloc_info *ai,
 	PCPU_SETUP_BUG_ON(offset_in_page(ai->unit_size));
 	PCPU_SETUP_BUG_ON(ai->unit_size < PCPU_MIN_UNIT_SIZE);
 	PCPU_SETUP_BUG_ON(ai->dyn_size < PERCPU_DYNAMIC_EARLY_SIZE);
+	PCPU_SETUP_BUG_ON(!ai->dyn_size);
 	PCPU_SETUP_BUG_ON(pcpu_verify_alloc_info(ai) < 0);
 
 	/* process group information and build config tables accordingly */
@@ -1700,14 +1701,12 @@ int __init pcpu_setup_first_chunk(const struct pcpu_alloc_info *ai,
 		schunk->free_size = dyn_size;
 		dyn_size = 0;			/* dynamic area covered */
 	}
-	schunk->contig_hint = schunk->free_size;
 
+	schunk->contig_hint = schunk->free_size;
 	schunk->map[0] = 1;
 	schunk->map[1] = ai->static_size;
-	schunk->map_used = 1;
-	if (schunk->free_size)
-		schunk->map[++schunk->map_used] = ai->static_size + schunk->free_size;
-	schunk->map[schunk->map_used] |= 1;
+	schunk->map[2] = (ai->static_size + schunk->free_size) | 1;
+	schunk->map_used = 2;
 	schunk->has_reserved = true;
 
 	/* init dynamic chunk if necessary */
-- 
2.9.3

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v2 00/23] percpu: replace percpu area map allocator with bitmap allocator Dennis Zhou <dennisz@fb.com> - 2017-07-25 01:10 +0200
  [PATCH v2 22/23] percpu: update pcpu_find_block_fit to use an iterator Dennis Zhou <dennisz@fb.com> - 2017-07-25 01:10 +0200
    Re: [PATCH v2 22/23] percpu: update pcpu_find_block_fit to use an  iterator Josef Bacik <josef@toxicpanda.com> - 2017-07-25 21:50 +0200
  [PATCH v2 09/23] percpu: combine percpu address checks Dennis Zhou <dennisz@fb.com> - 2017-07-25 01:10 +0200
    Re: [PATCH v2 09/23] percpu: combine percpu address checks Josef Bacik <josef@toxicpanda.com> - 2017-07-25 20:30 +0200
  [PATCH v2 02/23] percpu: introduce start_offset to pcpu_chunk Dennis Zhou <dennisz@fb.com> - 2017-07-25 01:10 +0200
    Re: [PATCH v2 02/23] percpu: introduce start_offset to pcpu_chunk Josef Bacik <josef@toxicpanda.com> - 2017-07-25 20:10 +0200
  [PATCH v2 13/23] percpu: generalize bitmap (un)populated iterators Dennis Zhou <dennisz@fb.com> - 2017-07-25 01:10 +0200
    Re: [PATCH v2 13/23] percpu: generalize bitmap (un)populated  iterators Josef Bacik <josef@toxicpanda.com> - 2017-07-25 20:40 +0200
    Re: [PATCH v2 13/23] percpu: generalize bitmap (un)populated  iterators Tejun Heo <tj@kernel.org> - 2017-07-26 16:10 +0200
  [PATCH v2 08/23] percpu: modify base_addr to be region specific Dennis Zhou <dennisz@fb.com> - 2017-07-25 01:10 +0200
    Re: [PATCH v2 08/23] percpu: modify base_addr to be region specific Josef Bacik <josef@toxicpanda.com> - 2017-07-25 20:30 +0200
  [PATCH v2 17/23] percpu: skip chunks if the alloc does not fit in the contig hint Dennis Zhou <dennisz@fb.com> - 2017-07-25 01:10 +0200
    Re: [PATCH v2 17/23] percpu: skip chunks if the alloc does not fit  in the contig hint Josef Bacik <josef@toxicpanda.com> - 2017-07-25 21:50 +0200
  [PATCH v2 19/23] percpu: update alloc path to only scan if contig hints are broken Dennis Zhou <dennisz@fb.com> - 2017-07-25 01:10 +0200
    Re: [PATCH v2 19/23] percpu: update alloc path to only scan if  contig hints are broken Josef Bacik <josef@toxicpanda.com> - 2017-07-25 21:40 +0200
  [PATCH v2 12/23] percpu: increase minimum percpu allocation size and align first regions Dennis Zhou <dennisz@fb.com> - 2017-07-25 01:10 +0200
    Re: [PATCH v2 12/23] percpu: increase minimum percpu allocation size  and align first regions Josef Bacik <josef@toxicpanda.com> - 2017-07-25 20:40 +0200
  [PATCH v2 01/23] percpu: setup_first_chunk enforce dynamic region must exist Dennis Zhou <dennisz@fb.com> - 2017-07-25 01:20 +0200
    Re: [PATCH v2 01/23] percpu: setup_first_chunk enforce dynamic  region must exist Josef Bacik <josef@toxicpanda.com> - 2017-07-25 20:10 +0200
  [PATCH v2 06/23] percpu: end chunk area maps page aligned for the populated bitmap Dennis Zhou <dennisz@fb.com> - 2017-07-25 01:20 +0200
    Re: [PATCH v2 06/23] percpu: end chunk area maps page aligned for  the populated bitmap Josef Bacik <josef@toxicpanda.com> - 2017-07-25 20:20 +0200
  Re: [PATCH v2 14/23] percpu: replace area map allocator with bitmap  allocator Josef Bacik <josef@toxicpanda.com> - 2017-07-25 21:20 +0200

csiph-web