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-next>] [day] [month] [year] [list]
Date:   Mon, 24 Oct 2022 21:41:46 +0800
From:   Chen Wandun <chenwandun@...wei.com>
To:     <akpm@...ux-foundation.org>, <mgorman@...hsingularity.net>,
        <vbabka@...e.cz>, <linux-mm@...ck.org>,
        <linux-kernel@...r.kernel.org>, <wangkefeng.wang@...wei.com>
Subject: [PATCH] mm: fix pcp count beyond pcp high in pcplist allocation

Nowadays there are several orders in pcplist, Function __rmqueue_pcplist
would alloc pcp batch pages to refill pcplist, when list of target order
if empty meanwhile other lists is not all empty, that result in pcp count
beyond pcp high after allocation. This behaviour can be easily observed by
adding debugging information in __rmqueue_pcplist.

Fix this by recalculate the batch pages to be allocated.

Fixes: 44042b449872 ("mm/page_alloc: allow high-order pages to be stored on the per-cpu lists")
Signed-off-by: Chen Wandun <chenwandun@...wei.com>
---
 mm/page_alloc.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 39f846d098f5..93e18b6de2f3 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -3742,6 +3742,7 @@ struct page *__rmqueue_pcplist(struct zone *zone, unsigned int order,
 	do {
 		if (list_empty(list)) {
 			int batch = READ_ONCE(pcp->batch);
+			int high = READ_ONCE(pcp->high);
 			int alloced;
 
 			/*
@@ -3753,6 +3754,7 @@ struct page *__rmqueue_pcplist(struct zone *zone, unsigned int order,
 			 */
 			if (batch > 1)
 				batch = max(batch >> order, 2);
+			batch = min(batch, (high - pcp->count) >> order);
 			alloced = rmqueue_bulk(zone, order,
 					batch, list,
 					migratetype, alloc_flags);
-- 
2.25.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ