From patchwork Fri Nov 24 11:05:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Charan Teja Kalla X-Patchwork-Id: 13467535 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 76F03C61D97 for ; Fri, 24 Nov 2023 11:06:30 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 12FDE6B06AC; Fri, 24 Nov 2023 06:06:30 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 0DE6B6B06AE; Fri, 24 Nov 2023 06:06:30 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EE9EC6B06B2; Fri, 24 Nov 2023 06:06:29 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id DB2AD6B06AC for ; Fri, 24 Nov 2023 06:06:29 -0500 (EST) Received: from smtpin24.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id A7D2AC18B6 for ; Fri, 24 Nov 2023 11:06:29 +0000 (UTC) X-FDA: 81492569298.24.269F72A Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by imf09.hostedemail.com (Postfix) with ESMTP id 1896E140018 for ; Fri, 24 Nov 2023 11:06:25 +0000 (UTC) Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=quicinc.com header.s=qcppdkim1 header.b=Ox4aOybw; spf=pass (imf09.hostedemail.com: domain of quic_charante@quicinc.com designates 205.220.168.131 as permitted sender) smtp.mailfrom=quic_charante@quicinc.com; dmarc=pass (policy=none) header.from=quicinc.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1700823986; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=XevrrF9/BcNyXtfgPOZjSxlAUBouemoME5zNztn1Vg8=; b=4iKQIdUrOISNigEyBurnQXCk8I6s+akUUCY5d4ekpcwwtL5umDOQFJnD9ndYedtiUl9rmx U+H9GbYfO/T+LbEZCSzpZg3aeIvvuR7yz/sVr5LGJnj81IpeALtJIvEK20bZfZWd8De5jI 4KBT+Ys6jYos5k/6lXvFJtf792fVqYE= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1700823986; a=rsa-sha256; cv=none; b=bfDXsZaVxDQhSlwDn1MawQ16ul/OHGuB8QAnleTZ+vTIZFDnMeNwdY/PxyQeNuZBMBvZkE 63oaFL5REEFYrbxNjhpOaiI3cXkv0RVbaieqIwLROyyp937TRqhASMss0PZA0y99h3qxbL jVpZg59KKqNIc0PKLKp9S3H9F9a22A8= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=pass header.d=quicinc.com header.s=qcppdkim1 header.b=Ox4aOybw; spf=pass (imf09.hostedemail.com: domain of quic_charante@quicinc.com designates 205.220.168.131 as permitted sender) smtp.mailfrom=quic_charante@quicinc.com; dmarc=pass (policy=none) header.from=quicinc.com Received: from pps.filterd (m0279866.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3AO66F0G031216; Fri, 24 Nov 2023 11:06:23 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=qcppdkim1; bh=XevrrF9/BcNyXtfgPOZjSxlAUBouemoME5zNztn1Vg8=; b=Ox4aOybwvkKC9GaMCV5HxQUruXA0yH6ef3yTi+Aul6L6RXTbWCdwnkRypAI8345YZycw yJvH3cLs/qnracKLrtjT/T/D4InOgWFrJMWYVgvlKNuOfBteTP97NMiJ7Kral8hU1LP1 GL1CckUcqJqRxW2uVg370rQxlbSy5U9JdiIJjE9TJGVP7gfm44AzAyTrUNLvLB42Oex/ x2i1D1ZfVRQ6qXci0dPDdio2iIGn6t4qCBJ1ov2e8+rSjvqPtzemEELdqOQKt+27ZfEe 28m12XHFxGouOry5v9vkWt6yW2/Li7IyV3qKBXkQ4zBCz2/jYxMGibTvNZ+eCobSYFbw tQ== Received: from nalasppmta01.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3ujp8x0ub6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 24 Nov 2023 11:06:23 +0000 Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA01.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 3AOB6NYA001785 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 24 Nov 2023 11:06:23 GMT Received: from hu-charante-hyd.qualcomm.com (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.40; Fri, 24 Nov 2023 03:06:19 -0800 From: Charan Teja Kalla To: , , , , , , CC: , , Charan Teja Kalla Subject: [PATCH V3 1/2] mm: page_alloc: correct high atomic reserve calculations Date: Fri, 24 Nov 2023 16:35:52 +0530 Message-ID: <1660034138397b82a0a8b6ae51cbe96bd583d89e.1700821416.git.quic_charante@quicinc.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: References: MIME-Version: 1.0 X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nalasex01a.na.qualcomm.com (10.47.209.196) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: vvC70aAGvT9o9sBR5JZxO4PBCB_o6bew X-Proofpoint-ORIG-GUID: vvC70aAGvT9o9sBR5JZxO4PBCB_o6bew X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.987,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-11-23_15,2023-11-22_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 adultscore=0 mlxlogscore=638 clxscore=1015 spamscore=0 lowpriorityscore=0 impostorscore=0 malwarescore=0 bulkscore=0 mlxscore=0 phishscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311060000 definitions=main-2311240086 X-Rspamd-Queue-Id: 1896E140018 X-Rspam-User: X-Rspamd-Server: rspam11 X-Stat-Signature: gy8wcbr1atm7d6wzts4bhhdzn815yezo X-HE-Tag: 1700823985-565816 X-HE-Meta: U2FsdGVkX19W5lx7gzgKXG/NKLMj2jX/aI2rlr1fTBYcZPVSns1qyS9xL8F+2CASsPYDR4kish4MMD/YJAsegfHUMJw5OEoxr0bun6uqDO2mlu9xy4BVsCcVxzcdHj93OJeFC4bzvDeVMBPEhXq6KKuBbs7PJeiOWDH7Xrpap9WwXqcVceY9D81FDuL6r9QoBeKpoiDgd2LRgV0OiXsTBaYHLigOz1Q8ue0whkj92Lp1lwkU3lw8H+PhQlxwF83+nEL+SjeKy0b+oW/77BzotbVrOP2f5P4FftqhKS9JUStdeXv3rPznAroRbk5MWMhJ9uneuJFLtA4P/zrGSHigJnuorCyCIVSrM9woDsJanLDTbdTP9SZFvEFLxTZ5UxLcNJ7oTMv14T1TC+3Tj+qtU3Zwo3DVsQBwrTNHLoGiRqU1rc679GvSZjbamDLyeAodFuWu+AK+BU7W/s656oRYH/TNjASsFIVpnHbp9w+FS+BFADzcJAWEb5tCZ/kYt/PN77+Ia9y+8Jf5LdL+HMTgWJ/HS6H6SEFjtKtzpGFRSNFEh75ZNGnDQKV+5NOxe9YgbmiiES7CWIAsq82/Mg0bjIQvoDSF+4Nm6yovV4ZEcoonwEF3QJvHUn695pHy7WKW/mA3oGaOUmiCKknAoaZyfCOcTrmfRMAoend6FazO8N/n46MODdAhMjROMFQnwhxMOvZQXFz7XXXTlt7Xh3F/07yofoMe7jIfH6iz7noe/0OQJdxmXfBSJrKgKZ33bJgGAtstr0QAmp3aB/ZjLfrjB0KUXo9AUggSvI3KWkkLDEZPSe8aAd9Q/386DHhpZpdGADQRo0Xv4bBVSXBoZ8h3fe3sHHHmDHKeKxZhiR4gk4RMTojyKeGG0PbfDGXgP2ibbtVGRG4ox07Q4Ya1g9r28JRAp85vn8pgQw0FkJftfu3lgDKv83tfwALtyHFwfPoBcQML6G3zIw3Re6rFM8/ 3F9mQnXo kDsYy5oyjEJ0nizo0z5kgsF81trvkU/T0Exc+HeuOrcHKqflRVPE+wngVHr5zLgS5LIRoVsmvMnSyMJB2Ey55RICGLQphU8OcZXgkuZVlLvXQD9EtJURqK7wR2y6eGmkEB39pLV5n8M+6r0YxHlElsfIsm5OFylmhCZE8iK7J9skupYV5HC98Zuczcvt62whEKgK8b4P+j/2zNkrVYRTdeuuYvm1g2LSx6gU14ZTk//1ADrSghodaEMO8AYaBEDZVqUm8EyZjIS+vEU2QWcqJT9IdC9YEnXt9GQvgxgr7pAgCWvRlZf6zWRZJUjOe83LH2+uDVD3jgTp7yUK+cBaNeRFi9ZN2yz9v2UsG5UG9OKb7+ak= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: reserve_highatomic_pageblock() aims to reserve the 1% of the managed pages of a zone, which is used for the high order atomic allocations. It uses the below calculation to reserve: static void reserve_highatomic_pageblock(struct page *page, ....) { ....... max_managed = (zone_managed_pages(zone) / 100) + pageblock_nr_pages; if (zone->nr_reserved_highatomic >= max_managed) goto out; zone->nr_reserved_highatomic += pageblock_nr_pages; set_pageblock_migratetype(page, MIGRATE_HIGHATOMIC); move_freepages_block(zone, page, MIGRATE_HIGHATOMIC, NULL); out: .... } Since we are always appending the 1% of zone managed pages count to pageblock_nr_pages, the minimum it is turning into 2 pageblocks as the nr_reserved_highatomic is incremented/decremented in pageblock sizes. Encountered a system(actually a VM running on the Linux kernel) with the below zone configuration: Normal free:7728kB boost:0kB min:804kB low:1004kB high:1204kB reserved_highatomic:8192KB managed:49224kB The existing calculations making it to reserve the 8MB(with pageblock size of 4MB) i.e. 16% of the zone managed memory. Reserving such high amount of memory can easily exert memory pressure in the system thus may lead into unnecessary reclaims till unreserving of high atomic reserves. Since high atomic reserves are managed in pageblock size granules, as MIGRATE_HIGHATOMIC is set for such pageblock, fix the calculations for high atomic reserves as, minimum is pageblock size , maximum is approximately 1% of the zone managed pages. Acked-by: Mel Gorman Signed-off-by: Charan Teja Kalla Acked-by: David Rientjes --- mm/page_alloc.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 733732e..a789dfd 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -1884,10 +1884,11 @@ static void reserve_highatomic_pageblock(struct page *page, struct zone *zone) unsigned long max_managed, flags; /* - * Limit the number reserved to 1 pageblock or roughly 1% of a zone. + * The number reserved as: minimum is 1 pageblock, maximum is + * roughly 1% of a zone. * Check is race-prone but harmless. */ - max_managed = (zone_managed_pages(zone) / 100) + pageblock_nr_pages; + max_managed = ALIGN((zone_managed_pages(zone) / 100), pageblock_nr_pages); if (zone->nr_reserved_highatomic >= max_managed) return; From patchwork Fri Nov 24 11:05:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Charan Teja Kalla X-Patchwork-Id: 13467536 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 70CCEC61D97 for ; Fri, 24 Nov 2023 11:06:38 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 093656B06B2; Fri, 24 Nov 2023 06:06:38 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 042D56B06B3; Fri, 24 Nov 2023 06:06:37 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E25706B06B4; Fri, 24 Nov 2023 06:06:37 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id D04C36B06B2 for ; Fri, 24 Nov 2023 06:06:37 -0500 (EST) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id B12F3B6E4B for ; Fri, 24 Nov 2023 11:06:37 +0000 (UTC) X-FDA: 81492569634.22.8D4EA94 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by imf22.hostedemail.com (Postfix) with ESMTP id 70621C002C for ; Fri, 24 Nov 2023 11:06:35 +0000 (UTC) Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=quicinc.com header.s=qcppdkim1 header.b=Yee6TmUt; spf=pass (imf22.hostedemail.com: domain of quic_charante@quicinc.com designates 205.220.168.131 as permitted sender) smtp.mailfrom=quic_charante@quicinc.com; dmarc=pass (policy=none) header.from=quicinc.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1700823995; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=unZr2r09oe2gFwUjtlqIUkcLXTRXdidcdfMvMtUu+oI=; b=WMMXtgwQC8rT3MRg3T9DxP0lPjO9R3YYr2hiWsdjLJ55TR0JUCKIRnK6mA8UscEke9civ9 HDOe99b6oYMmobXpepOd2rdl/gAgdUkvVIn6tciNhL20qDUN5t/ggGMHFNOWg3jOmP7oTL 1SuXS9Q7oUTQ7Wd8FmaYL8zrQC2fzys= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=pass header.d=quicinc.com header.s=qcppdkim1 header.b=Yee6TmUt; spf=pass (imf22.hostedemail.com: domain of quic_charante@quicinc.com designates 205.220.168.131 as permitted sender) smtp.mailfrom=quic_charante@quicinc.com; dmarc=pass (policy=none) header.from=quicinc.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1700823995; a=rsa-sha256; cv=none; b=mL6bLCsw0JQ6hQQdAiVBwQcB/lUVqEJlcKiVjxE/h9F4uiUIb98oshjR2qzr2rUOg0HaFS MUgAiS3R/6mp6snGHHc0CY5BcjfQpC+9eokUX65jt3yfhP77y0UdKzwwClpoF2JlSAI6v5 Z41LF/f/Cb8lMQon0Orx45wQxQVpTAI= Received: from pps.filterd (m0279866.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3AO7jbLs014209; Fri, 24 Nov 2023 11:06:33 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=qcppdkim1; bh=unZr2r09oe2gFwUjtlqIUkcLXTRXdidcdfMvMtUu+oI=; b=Yee6TmUtcPvEN+L5OUb/QQcawVX4DBg0hC1DrrjUBRE+13brZhRTvQ1QnHNG8LvMHQr7 6/RdViuY0Z4nWje2BRUx+yM9I68ays1OtOMD5MsOXCj83JecYG5HorhjrITy0a+iiC2W VEJLJrs9KT95KF/g8uFeTDcQTZmLHCaS/fEXMXjFJ7VLulYQIm4Y+9thi5qtbe7iSUcL YGdCT7CIr2g13MWJhpkIQf4OfWa84ArDHck1x1lZJn2iELJ1TBBEzQXvFRhLAucSvSLM X2MkH/ufAJiS2ugfQ0wWbE2DnOr72ubBGHrt7lte4fsV0sxUs3yW+ZnuQMvNKB9EGSxq Ww== Received: from nalasppmta01.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3ujp8x0ubf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 24 Nov 2023 11:06:33 +0000 Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA01.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 3AOB6WIs001974 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 24 Nov 2023 11:06:32 GMT Received: from hu-charante-hyd.qualcomm.com (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.40; Fri, 24 Nov 2023 03:06:28 -0800 From: Charan Teja Kalla To: , , , , , , CC: , , Charan Teja Kalla Subject: [PATCH V3 2/2] mm: page_alloc: enforce minimum zone size to do high atomic reserves Date: Fri, 24 Nov 2023 16:35:53 +0530 Message-ID: X-Mailer: git-send-email 2.7.4 In-Reply-To: References: MIME-Version: 1.0 X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nalasex01a.na.qualcomm.com (10.47.209.196) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: J5qhlPbAejO_GA495peGrZm6GGDU2tQF X-Proofpoint-ORIG-GUID: J5qhlPbAejO_GA495peGrZm6GGDU2tQF X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.987,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-11-23_15,2023-11-22_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 adultscore=0 mlxlogscore=887 clxscore=1015 spamscore=0 lowpriorityscore=0 impostorscore=0 malwarescore=0 bulkscore=0 mlxscore=0 phishscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311060000 definitions=main-2311240086 X-Rspamd-Queue-Id: 70621C002C X-Rspam-User: X-Stat-Signature: rkbrwiwad8ocirweh14ajb8gfti9zed7 X-Rspamd-Server: rspam01 X-HE-Tag: 1700823995-379595 X-HE-Meta: U2FsdGVkX1+xAtSWutnK33fHgI8jdUE9PZ7+fZyDi3ms3ly+bseVTnT8HXv6whotkT2ZhEn7muSFmOy9LWbOWwHqNPBkACVMvANcqQIX6rWGhr9keptfjH8hcnok/IA22FM4zF4zoKlPwBJ+AelxZn1Erz7ShEywZViGmztKB2Nk1I8uQmGlNLaXtTQtzvY5PGls/mhxWZZSULb2vja1Q9bcngLYscCG9XbAO4pwvLgeam8AS7npd+koBl4ekjxBN7t3z6+lbnwGbnJeLGXTI/IDbLhv6NLz7s8zQ7ATMZNLL5adFMhFhmD9q9mG+E5eho9PFzNh8wCuswNu6MywI8IOPOpo5+YLGSAOUe0oZ/dDKzc5VaOBiiy/nIFDrF2PyCWAZd4bWcrsea16/NMwScm6qtb1saRJMRTEZ/ktE8DRvvEsBgfb6vAJBh6ic0+bhxdZJIL8BvzDaA+jrEgRZTijCEZTro2dV98m/NmamFRg8wF9YWlDWHxay72eSvtuOo1O9V6ge1O4ezSLetQ9hFH48MqbmJUDMBVCL2tAkY4dI3n4v8Ru52RuI0iYYD9ipsgZal8weznKqQdLOUmcTlBAdDtQff8Zp452DezYK59KbSo9A/e1QBU+PwuWmt8ZP1bIcNBkm5jOd2TIL5ZU/O4RqZ+mCUVhLc5X2zTJTdfPXC+poL4PjZU0H9o1AuwYsUvfXtZKDcQ39xWgMgbh76xmDp4x6P/tLbGc4P5h8KuAVm83XdvpWDs2Hfddm29kR5v6h+7UVlWeTk6gCKYr4LqRGja2Q5suRK3XNV+XEVhwWwLdF+ZpWfNwfyDO+1rb91nN153EoiCgJvQldaERZ/9L+IRRNGQGRQUtWC773LJmy72pyLpjDEvQaRMOAbY+w94AW0c85UKgcLB8htOWZ0cF3oZfvnmdckU7CDuwCuCndPJyOs1LxvBHNkQ0PmQL2KTrJHxUvtLz/fpqT6l 8Z7g5DUb chuvACVHB8e1HnCXLIOYwmxTfp0f8xq12TqmRAqiAObE2UQhgdiC+vLXCAUB44/HN4zG9jw/9cvr9USFBGGcaYVyvAuUyxfOq5kKWY3TCnfy/DniNFXPvid4Tny5xfMoLL69BxkHQznZ5sG2EKmTI+fJmRKSRzgjpV1w+J6wHosqXr68hODYqFFL2EHsQdqid2Dzb5hoLDyOtGXkuyvdZ1RN/OgoEY2nU/z4UkcDrFs2xVgPMp9JfemMcUlt+5+asQxEpmToI+XTA8nbX0qKVJHkeVsSaR3FieobuSMnVmuVA1GS2COcpFAosCXJe4Imnn0ahJe9iraHyPnzvIrbzJjv63iDSkL9ZEIlyCbzn4g4H1bN53Y6POH/yKlSeSdldWyZ2rk/HivzpGD2oLtx9+NfZivKrXUw5Q2fo X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Highatomic reserves are set to roughly 1% of zone for maximum and a pageblock size for minimum. Encountered a system with the below configuration: Normal free:7728kB boost:0kB min:804kB low:1004kB high:1204kB reserved_highatomic:8192KB managed:49224kB On such systems, even a single pageblock makes highatomic reserves are set to ~8% of the zone memory. This high value can easily exert pressure on the zone. Per discussion with Michal and Mel, it is not much useful to reserve the memory for highatomic allocations on such small systems[1]. Since the minimum size for high atomic reserves is always going to be a pageblock size and if 1% of zone managed pages is going to be below pageblock size, don't reserve memory for high atomic allocations. Thanks Michal for this suggestion[2]. Since no memory is being reserved for high atomic allocations and if respective allocation failures are seen, this patch can be reverted. [1] https://lore.kernel.org/linux-mm/20231117161956.d3yjdxhhm4rhl7h2@techsingularity.net/ [2] https://lore.kernel.org/linux-mm/ZVYRJMUitykepLRy@tiehlicka/ Signed-off-by: Charan Teja Kalla Acked-by: David Rientjes --- mm/page_alloc.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index a789dfd..9f1b33e 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -1885,9 +1885,12 @@ static void reserve_highatomic_pageblock(struct page *page, struct zone *zone) /* * The number reserved as: minimum is 1 pageblock, maximum is - * roughly 1% of a zone. + * roughly 1% of a zone. But if 1% of a zone falls below a + * pageblock size, then don't reserve any pageblocks. * Check is race-prone but harmless. */ + if ((zone_managed_pages(zone) / 100) < pageblock_nr_pages) + return; max_managed = ALIGN((zone_managed_pages(zone) / 100), pageblock_nr_pages); if (zone->nr_reserved_highatomic >= max_managed) return;