From patchwork Sun Nov 5 12:50:47 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: 13445715 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 89046C4332F for ; Sun, 5 Nov 2023 12:51:27 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 859498D0005; Sun, 5 Nov 2023 07:51:26 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 808068D0002; Sun, 5 Nov 2023 07:51:26 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6CFB08D0005; Sun, 5 Nov 2023 07:51:26 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 5CBAC8D0002 for ; Sun, 5 Nov 2023 07:51:26 -0500 (EST) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 224F9C038C for ; Sun, 5 Nov 2023 12:51:26 +0000 (UTC) X-FDA: 81423886572.22.B1EB8CD Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by imf06.hostedemail.com (Postfix) with ESMTP id 08054180015 for ; Sun, 5 Nov 2023 12:51:22 +0000 (UTC) Authentication-Results: imf06.hostedemail.com; dkim=pass header.d=quicinc.com header.s=qcppdkim1 header.b=cL2CfozN; dmarc=pass (policy=none) header.from=quicinc.com; spf=pass (imf06.hostedemail.com: domain of quic_charante@quicinc.com designates 205.220.180.131 as permitted sender) smtp.mailfrom=quic_charante@quicinc.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1699188683; 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: references:dkim-signature; bh=ws0E3IMpr8r7oxbhnMYpQbr9QAYBBcg1XfkZGoPEQxM=; b=gOuKIRO8kJ+LpMxniMhvQTT4AZlb1xH8l8C0a3/kRr2+1qIhKsYJ5R6TozQs/IqP7mOKcs qw+ITC7EsNvb4pwObhI7XJeft+NThEnal1aizjRnYV7tQh8atLAU0ue/3j9bZNEpc/SvPH KkXelQzEnffFw7vE/1l8FMrMvbP6QGg= ARC-Authentication-Results: i=1; imf06.hostedemail.com; dkim=pass header.d=quicinc.com header.s=qcppdkim1 header.b=cL2CfozN; dmarc=pass (policy=none) header.from=quicinc.com; spf=pass (imf06.hostedemail.com: domain of quic_charante@quicinc.com designates 205.220.180.131 as permitted sender) smtp.mailfrom=quic_charante@quicinc.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1699188683; a=rsa-sha256; cv=none; b=j6fL2jZPT01d2i9CsJFBYcjU6Ke8hYO4gccRRllnVPbwD5nz1mrWawOq34eRaDSISM+pMz 7kC5w+DbG1W5RIjNna9tke0kIuP48bnMVwZKUjEJKZ/ePPIvrhlVH9oiUb5pHTKF2WUM1p LedQUamQPi8pDrZorwtErCktyNELD+g= Received: from pps.filterd (m0279870.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3A5CeWQo025850; Sun, 5 Nov 2023 12:51:21 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=ws0E3IMpr8r7oxbhnMYpQbr9QAYBBcg1XfkZGoPEQxM=; b=cL2CfozNXXHGjtyOcf0O1qJy03LsucahBs548E0Nb1ddPbdcMoWLQHZSwyOb//jvrv8h AVyAoCYNyeYktTY8/BEayjqcswBBGi7bHhaWE/QtGtVDSFt0MgcPAgU2beuB7x0x+LKB 1YTjDJD5Ad0zq6b2Z06M/PthQVkYyBXzb2za0Y4FZ/eprqlx5REiftnQ/Sdo9mJ3xpvb F6EgEGVxyGUgRoiuFOZhZfYtK3FwC4KH+u5WE/RdZjRPzQkHDC3j7V0ENTSkQg897DKf sQoHB8N4EXmr+/4NPUFgEJOX94BtxQ8GSq5y5hnbN7O7BzGCWvrxtGChy8GB1aWCfaxq /A== Received: from nalasppmta04.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3u5euysy21-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 05 Nov 2023 12:51:21 +0000 Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA04.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 3A5CpKe6011725 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 5 Nov 2023 12:51:20 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.39; Sun, 5 Nov 2023 04:51:16 -0800 From: Charan Teja Kalla To: , , , , , , CC: , , Charan Teja Kalla Subject: [PATCH V2 0/3] mm: page_alloc: fixes for early oom kills Date: Sun, 5 Nov 2023 18:20:47 +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: xsydmYasiE48f48Qk0xVDsXXH6yJuyM_ X-Proofpoint-ORIG-GUID: xsydmYasiE48f48Qk0xVDsXXH6yJuyM_ 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-05_10,2023-11-02_03,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 lowpriorityscore=0 malwarescore=0 impostorscore=0 mlxlogscore=613 phishscore=0 mlxscore=0 priorityscore=1501 adultscore=0 clxscore=1011 spamscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2310240000 definitions=main-2311050112 X-Rspamd-Queue-Id: 08054180015 X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: d1qeakgy4wydnycjsutquqnuk9n1pi1n X-HE-Tag: 1699188682-409105 X-HE-Meta: U2FsdGVkX19HztIA9w9/6HznDazy9X6R8UeLLXR1adVr7Zmh9kRnYCw6crBAvMwnjG+BijnCzbdcmLlqWod3zDp3I9htkB9DHfirzy52qykUM5+78fqcyLx3lwfWgK+6fNmr4fNBomgdccoDwSpqraHvTXenCCL5ZVyKzAJTad5WL7yN9v62Du0CiELiB0dsQlhjycviytJzvrtu4/g3s2rkq0vs66oSI5eub/RD7j/BHi0HfgZf4vS/2DoJzdGfyjeR+VMmmTPwSygOhSBRv+ZbSJD959yoTY1BCGG0QFI94bMspMKuUwaYapMmWw6MB8QWN9oT0iYxIdtn7Ljt4V1IHH6Ti0fQC6bqj6TnzWQAk06SFZ7qy3ll5WpWx4mjeduj2nzP+tiMCCul8cK0qCrG8ddsT/SyFlqA6Q/vlJ9JXn/HImPZfUrBB07nSMBxpOiz5hYQ3WgIuqngKoSBlEDNk8LTfticOUutbzI9snp9LR1wZdGxW2clmLzATqpIn7RUSZNZkqAk/oPBLxwTnWfi1WLn5VkOtfvAfUwRmoYUwDLyOIKLIZo03OLozu/vZ48SHsjx3QLfoyOiAYLF7vt4wFqzMBv4QoG/j2JIxiqNeJMxJ5mTT7wZG0jL9hGEIDnqkLZIxKNLT2f4D4m8o+i0l/pYjNKcQqSpqWoE4R3LfLztw45wCidVDHuumtViLGczDe1vZ5AfgiAJEF2okSaiCuVkZPwFfTWYbYcolBXeDXzqd0PlgtJ6cTSd/TPlNtAAWxCvTPWIuV+FbHDEv6sqEqknoBcUf4K+VaWXlNgwHzdYg33HgPqo0kwJel7Rhgyh6yj6PJVgBobi+Ak6iDJkpd5liF6SmpAmMaqmAgkXpXnWdBVwDrroi37KQdyjifW7GVK693Ypsrx5j8/3U8S/pC6JgqH53KAr4Ilg8TYcBxE2Bngiexw+K8QBm1qzISw18VSurxl3vFelstI vOdKOxSn nwBLVrPdjJYbJx0oxU5/ue8IM1fO+W5Txi77mfLrm2od1JzmYRLNS2oqdn2hEbjpqJNyXTzhsnDMiip06wnC9oTTpBq3vSJL7ScbdG4NLdejWVXIY+pn5pwCaHaIq50QEPRZw6eVJ1N3Qb13zjyqKjIrfNUD5HzkKJjdES6eKXgQRYsfWQs3lkjjJ/J9NWQSd/rneg6km4clW7uOQumL3ZqcM3RROaZVcd/Bh2K3g+JFGee2rkvhONHFShcu9PiWBt9XKKMWSeZdW51+holFNCo0I4Avj56L7tYNCjrZsx+Ok8frttHluew1h53JJ8NM5Xnia 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: Ealry OOM is happened on a system with out unreserving the highatomic page blocks and draining of pcp lists for an allocation request. The state of the system where this 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 log: a) OOM is occurred with out unreserving the high atomic page blocks. b) ~16MB of memory reserved for high atomic reserves against the expectation of 1% reserves. These 2 issues are tried to be fixed in 1st and 2nd patch. Another excerpt from the oom kill message: Normal free:760kB boost:0kB min:768kB low:960kB high:1152kB reserved_highatomic:0KB managed:49152kB free_pcp:460kB In the above, pcp lists too aren't drained before entering into oom kill path. This is tried to be fixed in 3rd patch. 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 (3): mm: page_alloc: unreserve highatomic page blocks before oom mm: page_alloc: correct high atomic reserve calculations mm: page_alloc: drain pcp lists before oom kill mm/page_alloc.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-)