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;