From patchwork Fri Nov 24 11:05:51 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: 17054 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:ce62:0:b0:403:3b70:6f57 with SMTP id o2csp1087587vqx; Fri, 24 Nov 2023 03:10:42 -0800 (PST) X-Google-Smtp-Source: AGHT+IFOyi3MWubSPi2+8LV72qeqd54wA4IVOd5rk7C++8rxxUu2qFvvoiTGDPaogaphifLpra7r X-Received: by 2002:a17:90b:1a8e:b0:285:9893:b31a with SMTP id ng14-20020a17090b1a8e00b002859893b31amr363000pjb.44.1700824242290; Fri, 24 Nov 2023 03:10:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700824242; cv=none; d=google.com; s=arc-20160816; b=t0w9Mv+Yb174xOR+xUmvX6SFLQNBHp5NdnpxLtl5001hFQr7Rq0ScEOrhPh9+ARBr7 tvf04Sh1SCZy1XUiIhc2cwXiXoSCkmbgUhrEdjt9onLj2B5D6Cwjr4KDLhSLMZd55rfn Hk03PakJ85QDDATfOngHDRL1F6jKy8yTnqsFAKWAJHOdS0w1wpkFB36UDQVIvctIC77F Yl1uaDUncPASvBajjiV8mZmHFR5PUoEmovHwtOIs5WBOStx1llpu04zylhiTtKLe3Q3b 8O8auIYb96ixtkUKyNABfcIfiRTrN0iAd1gLUWxg7GRTh7MCObBaqMB5aoTe/K0mqj+j Gfuw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from :dkim-signature; bh=J+LuJGeCVyBu3dlVJFr7/BB9Eb1zeMspyoB56KMLigA=; fh=OEZ1X2ugt64Sg3RaiLhA7IjZ0579kVxN/CI/M7AE/gY=; b=jNvoBVI5i6mvejUF8cGdxkG4wJKMNam6L51ac9JSsxQrffYj/SppGzKqn8T74z0sSU v1s72M4foHjRqJuqKD2PZgRnDwZR5+dxLLh+H1gS2Cl5041qkxnIaL+q9Yp9+qpke+51 ln3D9/XNMzYdrtiJvaaxejwxXRNL2cjrHoQnGzTa8i4ZJq4oSizd3gHBKTJNKQd3lPFB 3b7lbgmiBIo8UuRLtTmI/VJlAQy9XvvEQ/2mmR2jTlX3KpX1r6aEh7qdgBoyk1mK6gRb uaME9XO/apchDmw8RbJRhmC1aehnzkF0l5YOYQoH20WmEHyPOkjJMrWBZpbq+St3ts1w ccGw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=G+1CJK91; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id v22-20020a63d556000000b005b92ab9ce80si3314880pgi.460.2023.11.24.03.10.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Nov 2023 03:10:42 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=G+1CJK91; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id E031D80781C0; Fri, 24 Nov 2023 03:06:33 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345621AbjKXLGY (ORCPT + 99 others); Fri, 24 Nov 2023 06:06:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44638 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345606AbjKXLGW (ORCPT ); Fri, 24 Nov 2023 06:06:22 -0500 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 05943D5A for ; Fri, 24 Nov 2023 03:06:28 -0800 (PST) Received: from pps.filterd (m0279869.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3AO6oCsq002993; Fri, 24 Nov 2023 11:06:15 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=from : to : cc : subject : date : message-id : mime-version : content-type; s=qcppdkim1; bh=J+LuJGeCVyBu3dlVJFr7/BB9Eb1zeMspyoB56KMLigA=; b=G+1CJK91OKIA8HhR3iFaDZChFXKUIx8sXvdOVFwyuggMWyLI2geCsxeOqV5rVMe5X2rV Wusf1NcqLP40dkG6Q54+HZ+aTQS/2fRZyxQEhiWUUnI8Vvs0dqgL9P0bBSX3olnZX/p3 UUSghDKZUHroc0ks2WgNU9AFkl4mtqHXkaHrZR/iu3uSOlvXzqjwLHD0pOP8ypWocpr6 aI+/KjhRuQnXAA6tPpcj+76iG8Hv4kInfRQRt8xmNCJuDRhneFmc2tva0XHO4nLGKVFm jSopL/3g9EBDyF4QrNZh2FXD/3KlhOKMriwHCRhSMFL7TfVpsL/fx2AZNS5PRDY3Hh8S XQ== Received: from nalasppmta05.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3ujgqdsah3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 24 Nov 2023 11:06:14 +0000 Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA05.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 3AOB6DYf004386 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 24 Nov 2023 11:06:13 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:10 -0800 From: Charan Teja Kalla To: , , , , , , CC: , , Charan Teja Kalla Subject: [PATCH V3 0/2] mm: page_alloc: fixes for high atomic reserve caluculations Date: Fri, 24 Nov 2023 16:35:51 +0530 Message-ID: X-Mailer: git-send-email 2.7.4 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: ghGgIOe1QhYAgzNMuJUHKDWeKBInfhG2 X-Proofpoint-ORIG-GUID: ghGgIOe1QhYAgzNMuJUHKDWeKBInfhG2 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 clxscore=1015 mlxscore=0 bulkscore=0 spamscore=0 impostorscore=0 suspectscore=0 malwarescore=0 adultscore=0 priorityscore=1501 phishscore=0 mlxlogscore=615 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311060000 definitions=main-2311240086 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Fri, 24 Nov 2023 03:06:34 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1783443480873267073 X-GMAIL-MSGID: 1783443480873267073 The state of the system where the issue exposed shown in oom kill logs: [ 295.998653] Normal free:7728kB boost:0kB min:804kB low:1004kB high:1204kB reserved_highatomic:8192KB active_anon:4kB inactive_anon:0kB active_file:24kB inactive_file:24kB unevictable:1220kB writepending:0kB present:70732kB managed:49224kB mlocked:0kB bounce:0kB free_pcp:688kB local_pcp:492kB free_cma:0kB [ 295.998656] lowmem_reserve[]: 0 32 [ 295.998659] Normal: 508*4kB (UMEH) 241*8kB (UMEH) 143*16kB (UMEH) 33*32kB (UH) 7*64kB (UH) 0*128kB 0*256kB 0*512kB 0*1024kB 0*2048kB 0*4096kB = 7752kB From the above, it is seen that ~16MB of memory reserved for high atomic reserves against the expectation of 1% reserves which is fixed in the 1st patch. Don't reserve the high atomic page blocks if 1% of zone memory size is below a pageblock size. Changes in V3: o Seperated the patch of unreserving the high atomic pageblock done from should reclaim retry. o Don't reserve high atomic page blocks for smaller zone sizes. Changes in V2: o Unreserving the high atomic page blocks is done from should_reclaim_retry() o Reserve minimum and max memory for high atomic reserves as a pageblock and 1% of the memory zone respectively. o drain the pcp lists before falling back to OOM. o https://lore.kernel.org/linux-mm/cover.1699104759.git.quic_charante@quicinc.com/ Changes in V1: o Unreserving the high atomic page blocks is tried to fix from the oom kill path rather than in should_reclaim_retry() o discussed why a lot more than 1% of managed memory is reserved for high atomic reserves. o https://lore.kernel.org/linux-mm/1698669590-3193-1-git-send-email-quic_charante@quicinc.com/ Charan Teja Kalla (2): mm: page_alloc: correct high atomic reserve calculations mm: pagealloc: enforce minimum zone size to do high atomic reserves mm/page_alloc.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)