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


Groups > linux.kernel > #1695231

[PATCH v2 04/23] percpu: setup_first_chunk remove dyn_size and consolidate logic

Path csiph.com!aioe.org!bofh.it!news.nic.it!robomod
From Dennis Zhou <dennisz@fb.com>
Newsgroups linux.kernel
Subject [PATCH v2 04/23] percpu: setup_first_chunk remove dyn_size and consolidate logic
Date Tue, 25 Jul 2017 01:10:01 +0200
Message-ID <u6UE9-3ig-5@gated-at.bofh.it> (permalink)
References <u6UE9-3ig-3@gated-at.bofh.it>
Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=fb.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=facebook; bh=4f8v04TTKJI5qlGmldGrBKpetAaL9omWp8NhrmeOU2A=; b=DwTzQ5BW9yykQ+lLE4T1IEvZ1EPTKlv/ia85tL+pFWVfvWPyhVn8jE2KZADRIO2RXvQ5 kdNxwAJw4aHwu1isnPNFWAiGAiSNXcitOrymxwBSKfbjLiMct8b24BSVwrLhGZHZaicj fL2eHi4bkbMo9YG0aF+nvHrXHP8aRxL+99U=
X-Mailer git-send-email 2.13.3
MIME-Version 1.0
Content-Type text/plain
X-Originating-IP [192.168.52.123]
X-Proofpoint-Spam-Reason safe
X-Fb-Internal Safe
X-Proofpoint-Virus-Version vendor=fsecure engine=2.50.10432:,, definitions=2017-07-24_14:,, signatures=0
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 64
Organization linux.* mail to news gateway
X-Original-Cc <linux-kernel@vger.kernel.org>, <linux-mm@kvack.org>, <kernel-team@fb.com>, Dennis Zhou <dennisszhou@gmail.com>
X-Original-Date Mon, 24 Jul 2017 19:02:01 -0400
X-Original-Message-ID <20170724230220.21774-5-dennisz@fb.com>
X-Original-References <20170724230220.21774-1-dennisz@fb.com>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1695231

Show key headers only | View raw


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

There is logic for setting variables in the static chunk init code that
could be consolidated with the dynamic chunk init code. This combines
this logic to setup for combining the allocation paths. reserved_size is
used as the conditional as a dynamic region will always exist.

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

diff --git a/mm/percpu.c b/mm/percpu.c
index 470e1a0..851aa81 100644
--- a/mm/percpu.c
+++ b/mm/percpu.c
@@ -1562,8 +1562,7 @@ int __init pcpu_setup_first_chunk(const struct pcpu_alloc_info *ai,
 {
 	static int smap[PERCPU_DYNAMIC_EARLY_SLOTS] __initdata;
 	static int dmap[PERCPU_DYNAMIC_EARLY_SLOTS] __initdata;
-	size_t dyn_size = ai->dyn_size;
-	size_t size_sum = ai->static_size + ai->reserved_size + dyn_size;
+	size_t size_sum = ai->static_size + ai->reserved_size + ai->dyn_size;
 	struct pcpu_chunk *schunk, *dchunk = NULL;
 	unsigned long *group_offsets;
 	size_t *group_sizes;
@@ -1690,14 +1689,7 @@ int __init pcpu_setup_first_chunk(const struct pcpu_alloc_info *ai,
 	bitmap_fill(schunk->populated, pcpu_unit_pages);
 	schunk->nr_populated = pcpu_unit_pages;
 
-	if (ai->reserved_size) {
-		schunk->free_size = ai->reserved_size;
-		pcpu_reserved_chunk = schunk;
-	} else {
-		schunk->free_size = dyn_size;
-		dyn_size = 0;			/* dynamic area covered */
-	}
-
+	schunk->free_size = ai->reserved_size ?: ai->dyn_size;
 	schunk->contig_hint = schunk->free_size;
 	schunk->map[0] = 1;
 	schunk->map[1] = schunk->start_offset;
@@ -1705,7 +1697,9 @@ int __init pcpu_setup_first_chunk(const struct pcpu_alloc_info *ai,
 	schunk->map_used = 2;
 
 	/* init dynamic chunk if necessary */
-	if (dyn_size) {
+	if (ai->reserved_size) {
+		pcpu_reserved_chunk = schunk;
+
 		dchunk = memblock_virt_alloc(pcpu_chunk_struct_size, 0);
 		INIT_LIST_HEAD(&dchunk->list);
 		INIT_LIST_HEAD(&dchunk->map_extend_list);
@@ -1717,7 +1711,7 @@ int __init pcpu_setup_first_chunk(const struct pcpu_alloc_info *ai,
 		bitmap_fill(dchunk->populated, pcpu_unit_pages);
 		dchunk->nr_populated = pcpu_unit_pages;
 
-		dchunk->contig_hint = dchunk->free_size = dyn_size;
+		dchunk->contig_hint = dchunk->free_size = ai->dyn_size;
 		dchunk->map[0] = 1;
 		dchunk->map[1] = dchunk->start_offset;
 		dchunk->map[2] = (dchunk->start_offset + dchunk->free_size) | 1;
-- 
2.9.3

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


Thread

[PATCH v2 04/23] percpu: setup_first_chunk remove dyn_size and consolidate logic Dennis Zhou <dennisz@fb.com> - 2017-07-25 01:10 +0200
  Re: [PATCH v2 04/23] percpu: setup_first_chunk remove dyn_size and  consolidate logic Josef Bacik <josef@toxicpanda.com> - 2017-07-25 20:10 +0200

csiph-web