lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1437404130-5188-2-git-send-email-bhe@redhat.com>
Date:	Mon, 20 Jul 2015 22:55:29 +0800
From:	Baoquan He <bhe@...hat.com>
To:	tj@...nel.org, cl@...ux-foundation.org, linux-mm@...ck.org,
	linux-kernel@...r.kernel.org
Cc:	Baoquan He <bhe@...hat.com>
Subject: [PATCH 2/3] perpuc: check pcpu_first_chunk and pcpu_reserved_chunk to avoid handling them twice

In pcpu_setup_first_chunk() pcpu_reserved_chunk is assigned to point to
static chunk. While pcpu_first_chunk is got from below code:

	pcpu_first_chunk = dchunk ?: schunk;

Then it could point to static chunk too if dynamic chunk doesn't exist. So
in this patch adding a check in percpu_init_late() to see if pcpu_first_chunk
is equal to pcpu_reserved_chunk. Only if they are not equal we add
pcpu_reserved_chunk to the target array.

Signed-off-by: Baoquan He <bhe@...hat.com>
---
 mm/percpu.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/mm/percpu.c b/mm/percpu.c
index a63b4d8..f7e02c0 100644
--- a/mm/percpu.c
+++ b/mm/percpu.c
@@ -2260,11 +2260,18 @@ void __init setup_per_cpu_areas(void)
 void __init percpu_init_late(void)
 {
 	struct pcpu_chunk *target_chunks[] =
-		{ pcpu_first_chunk, pcpu_reserved_chunk, NULL };
+		{ pcpu_first_chunk, NULL, NULL };
 	struct pcpu_chunk *chunk;
 	unsigned long flags;
 	int i;
 
+	/*
+	 * pcpu_first_chunk could be the same as pcpu_reserved_chunk, add it to the
+	 * target array only if pcpu_first_chunk is not equal to pcpu_reserved_chunk.
+	 */
+	if (pcpu_first_chunk != pcpu_reserved_chunk)
+		target_chunks[1] = pcpu_reserved_chunk;
+
 	for (i = 0; (chunk = target_chunks[i]); i++) {
 		int *map;
 		const size_t size = PERCPU_DYNAMIC_EARLY_SLOTS * sizeof(map[0]);
-- 
1.9.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ