From mboxrd@z Thu Jan 1 00:00:00 1970 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 CB6DDC4332F for ; Sun, 5 Nov 2023 12:55:15 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 572E68D0006; Sun, 5 Nov 2023 07:55:15 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 52DDD8D0002; Sun, 5 Nov 2023 07:55:15 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3EB358D0006; Sun, 5 Nov 2023 07:55:15 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 303D88D0002 for ; Sun, 5 Nov 2023 07:55:15 -0500 (EST) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id EE2FA40426 for ; Sun, 5 Nov 2023 12:55:14 +0000 (UTC) X-FDA: 81423896148.20.E61A6C7 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by imf26.hostedemail.com (Postfix) with ESMTP id B57B6140004 for ; Sun, 5 Nov 2023 12:55:12 +0000 (UTC) Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=quicinc.com header.s=qcppdkim1 header.b=VlIV8tmJ; spf=pass (imf26.hostedemail.com: domain of quic_charante@quicinc.com designates 205.220.180.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=1699188912; 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:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=8i5tn46KEI/5G3fVJypRas8+siCYTKCKkxGxN88a+hw=; b=zDk5KpY6emL4sPwmiypXrvJUmsmgfR6O+CCRedgZ1/xbWzn8scmpBATUUOsdm3oIdf2Q5l DgwEOudb3r/Tj7dcXm2S9D3v07h95WctOMAigzkc9XocA8VONpF/xxjURBnOcLamMUkgNr r4IOvxhguhalocNzCQ+LY85xneteYR8= ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=pass header.d=quicinc.com header.s=qcppdkim1 header.b=VlIV8tmJ; spf=pass (imf26.hostedemail.com: domain of quic_charante@quicinc.com designates 205.220.180.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=1699188912; a=rsa-sha256; cv=none; b=Q1T3vZ/xtBzBt+GsE6gw0uwke184mNmnLzisEc393NZyocI7wbUujKQucIUI3GRscS3n7o DXmMs9tv/EZJHkVaXFc7rltjV9xFd2Y14rJFpu/dB7Toz27vTQWApsiRUFuKtX0ibikmqe 7MdtYubC0d3cO4Fxg82kcXz1eYVRBWM= 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 3A5Cix0A014641; Sun, 5 Nov 2023 12:55:11 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=message-id : date : mime-version : subject : to : cc : references : from : in-reply-to : content-type : content-transfer-encoding; s=qcppdkim1; bh=8i5tn46KEI/5G3fVJypRas8+siCYTKCKkxGxN88a+hw=; b=VlIV8tmJOJgkvvDGmXHTVQAe7Zv+12cM7H1IYGqbmmCRZ8MgZwAGzOSQZKfEXWQ80JTS oO08+/1CbVgkUKoCKBJ8Kzrco/0MK0+3nfGnz0vmSGcP2yZes5rncaP90YbUB7/lEluT jqwim8hYoaI6AAvB+BcWeIM/+JQUe3hkA9E/lhpxGAFJZWWpHIOqvvrVNxYL+iopS0ll oPN0UU/8rq3424rbOUxPA8fvuspdilMIw4KWyP8JsHIoJsffEzspUp064TZy/eArHcm0 2JB6HyjVU7TWiGjUQOQBbpxYJ9qO4rFqnNnLAffvZfaD4GPxXTj8PlX9o30Jd7uVRXKq fQ== Received: from nalasppmta05.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3u5exhsxku-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 05 Nov 2023 12:55:11 +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 3A5CtALq026698 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 5 Nov 2023 12:55:10 GMT Received: from [10.216.52.187] (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:55:06 -0800 Message-ID: <507ca004-67e0-e969-529a-c97deb33f6f0@quicinc.com> Date: Sun, 5 Nov 2023 18:25:00 +0530 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Subject: Re: [PATCH V3 3/3] mm: page_alloc: drain pcp lists before oom kill To: , , , , , , CC: , References: Content-Language: en-US From: Charan Teja Kalla In-Reply-To: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) 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-ORIG-GUID: XpjOLRZcW_bN2G5vMA8IBrRswjdtp0NN X-Proofpoint-GUID: XpjOLRZcW_bN2G5vMA8IBrRswjdtp0NN 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 impostorscore=0 malwarescore=0 phishscore=0 suspectscore=0 bulkscore=0 mlxlogscore=465 lowpriorityscore=0 mlxscore=0 priorityscore=1501 clxscore=1015 spamscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2310240000 definitions=main-2311050112 X-Rspamd-Queue-Id: B57B6140004 X-Rspam-User: X-Stat-Signature: n7jct9pfk9czkng1mpxwsd4nj4fhun3z X-Rspamd-Server: rspam01 X-HE-Tag: 1699188912-366948 X-HE-Meta: U2FsdGVkX19YLlzz5rGYTlguBF4THiBfsOafdDvfjOVql0EjIckKYVZOJFT62+s2bblhlg8FPhStxwK6x/jjs2+K1URal2amjSMcls15E6JWoEYqUUJxxmJuLeahnu0Q1ngi3z9Y3KP5BJ58paJJCUUb5YxwLKyAFAzx5HF+2+FE5u+efUUMdvc5HfmAqls4/jtfBkrl0wDYEQHnK8TG9ri8i+SqHOozRrCfIXltpoTocaAU3vkhGOQNbkoFF7ZDK7kJOwD/LxoXAspjGM/5pl9YyEj550gN3Tvd/iKpgtSGWGxoTNURAahkdRtME5zwSmiOwlNQ9ICDbB7ocfju6WET5vgzVuCNDCxYgM/zA451ocZ9RFRtft5gG7+tiE+P1/kp2V7HkJe7ziiLpeVf2PWeb1DbJxQ9hcVOgJO0XBFgU8JI58H+1q46VsinnoaKHCcCGBBlxoiN21TdPe3vi5bLMStPj1KmhkIDonZF/q1MlQ3oTA9BHpDL/sRa+IrByImLvR0SWIEVG2NjaPX6r1g/RpNdrDRjvstemVcH+DIVEmU/YuPsenwc+yp9XvwvgPwnSLY6VNOYl17escK04VMa3N2rhxwr0xX7+DaX5C/BAfdzMRm/ykjP52zp04f4xJOVNXZFC89lMuSMFEwRa+XV/IvjDCTlDVOCSDGoEw5qEnC27OIXiDW4/+nB03WYu5KooF02FTU7ZuEcFfaxTO5MBLzP7lwwRxFfnjeGw8GAMAiGa9kYQesajm+xhgFAa/g2zg3UKh68JxbngyGeCUXz8KzLquVQSL3oxZmWBW4JDwwwxYGD43ztkJsuxj6eWMR7NYTsWiYm/CA+quoX3v8Y4X0aDrZOyyHSSXr31TZWPm9kDU5AXyBSF18VtYttHh3BNmgPpYr/zeKmoHjy4+C6rUgQwfOfGmc75nMfaWshV3M7AsLVwv5Gkj7wM8UIKoazfWnTH/G+aMhMwVG 2SW7qF1w /ZajKmQUMM8JaAk3Fj4/TGJ9zi5ORQLu6g5C8g+lFxYbkeQx13EgC3Sp5dVfCYUNM6EdIJG4+O4ENnr6QngtGupzkxwvHxR2dcf0Z6Llefjat0Oyu0k5+emx9IIe0Sdx5RhHV7A81pj1oI3JMJbNfG7eca76D3dg9jDggWVHamTZb9WujWA3bRe4HEHOSqCLyOynO0LHNzkv2A0x+f3Pclb4K5dLD9TamS5jjHzt445lp5qTCD8UGP7XwRgH+Uuyu9Jo2Pb6NsMQlfQKGqMMYXMImM+lgdONoyVlDwbJo5LEbSHksCt1PC6gz0Q== 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: Sorry, this is supposed to be PATCH V2 in place of V3. Not sure If I have to resend it as V2 again. On 11/5/2023 6:20 PM, Charan Teja Kalla wrote: > pcp lists are drained from __alloc_pages_direct_reclaim(), only if some > progress is made in the attempt. > > struct page *__alloc_pages_direct_reclaim() { > ..... > *did_some_progress = __perform_reclaim(gfp_mask, order, ac); > if (unlikely(!(*did_some_progress))) > goto out; > retry: > page = get_page_from_freelist(); > if (!page && !drained) { > drain_all_pages(NULL); > drained = true; > goto retry; > } > out: > } > > After the above, allocation attempt can fallback to > should_reclaim_retry() to decide reclaim retries. If it too return > false, allocation request will simply fallback to oom kill path without > even attempting the draining of the pcp pages that might help the > allocation attempt to succeed. > > VM system running with ~50MB of memory shown the below stats during OOM > kill: > Normal free:760kB boost:0kB min:768kB low:960kB high:1152kB > reserved_highatomic:0KB managed:49152kB free_pcp:460kB > > Though in such system state OOM kill is imminent, but the current kill > could have been delayed if the pcp is drained as pcp + free is even > above the high watermark. > > Fix this missing drain of pcp list in should_reclaim_retry() along with > unreserving the high atomic page blocks, like it is done in > __alloc_pages_direct_reclaim(). > > Signed-off-by: Charan Teja Kalla > --- > mm/page_alloc.c | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) > > diff --git a/mm/page_alloc.c b/mm/page_alloc.c > index b91c99e..8eee292 100644 > --- a/mm/page_alloc.c > +++ b/mm/page_alloc.c > @@ -3857,8 +3857,10 @@ should_reclaim_retry(gfp_t gfp_mask, unsigned order, > cond_resched(); > out: > /* Before OOM, exhaust highatomic_reserve */ > - if (!ret) > - return unreserve_highatomic_pageblock(ac, true); > + if (!ret) { > + ret = unreserve_highatomic_pageblock(ac, true); > + drain_all_pages(NULL); > + } > > return ret; > }