Received: by 2002:a05:7412:3290:b0:fa:6e18:a558 with SMTP id ev16csp536402rdb; Fri, 26 Jan 2024 03:25:28 -0800 (PST) X-Google-Smtp-Source: AGHT+IHzCeUhCslzI8y3PQ7eNsMnrXZYUwZKQdtGojUj3XmO3fNtsDPDZpsMPi6LKqxKo6OXSWOU X-Received: by 2002:a05:6359:4c25:b0:176:7c21:b033 with SMTP id kj37-20020a0563594c2500b001767c21b033mr1144908rwc.46.1706268328066; Fri, 26 Jan 2024 03:25:28 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706268328; cv=pass; d=google.com; s=arc-20160816; b=OVyLIqedXwdZfZifjbwjD/lUDB6BfqBJFP8Mz9HPSfDXzXb85Dq2SvKJJD5lj4uO30 beTxNxOITXR32Do9zuh8+NKIQeunjSvjnkO/c51fvsTgVBEdiQskoHgvTJAxubEejyhg xudQPmWeeYB8DyKw8g5GAentvEZ8pOxSWCxQKGMxi+lledjFReXP9e3O/eMNTT3pZYJA SWTYNU0i6MQRXsbtMbxSRY3D+8B88rHNvIPCOsV4Cf5ocvQDryKgn9+LmeRVfVKCfpV7 QE+VioeUYdRbPac6njr7q3sUreKzoTwST64lYALuVnB8t2YtO8ASE8X/ApGE9xohus7I RvcQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=Dr1b+LNasWBfDiz6qm0FOfD2D0DAEk8L38V0AafYadw=; fh=CRMZtJCE/9BngovRJ1tN2PLnkcScM+b5fGjQCBIuvf4=; b=Cl9DKToxh6Z9snwzmTxDBk2AJvuRyYWG3QLDmssJIiZi5hGjTIoDe0yBmQpCvNXWlE j3uf+flN5XRvD0yDPEUiDK1hwyyMj0q0JQEOkhoil3Td4YVmos6wztqlAcxtOt9aeMo4 RXUQAzE6PGCibi02mr/7EIm8jjI508qX6nx0OFCSSxvzsgCW0E00W+Gp1tpxC6cQ/5Ks 6JSasXdnlMVH3DLZ4DzXb/KMedHZEOeVU2Ls6kuHUv9e1WGQf2b6cwKi8CoXmlEPg/Cb cXk5rK2EzAOMyCPYhOwR+qVimdU/WO+2NMVfrCX6J0CwHYLVsphaP7wQZkmdSkDDe3Ax mw4w== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=TVYwDy3F; arc=pass (i=1 spf=pass spfdomain=quicinc.com dkim=pass dkdomain=quicinc.com dmarc=pass fromdomain=quicinc.com); spf=pass (google.com: domain of linux-kernel+bounces-40003-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-40003-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id q26-20020a65685a000000b005cf14c2aeacsi943585pgt.117.2024.01.26.03.25.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Jan 2024 03:25:28 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-40003-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=TVYwDy3F; arc=pass (i=1 spf=pass spfdomain=quicinc.com dkim=pass dkdomain=quicinc.com dmarc=pass fromdomain=quicinc.com); spf=pass (google.com: domain of linux-kernel+bounces-40003-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-40003-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 8737BB43255 for ; Fri, 26 Jan 2024 10:47:40 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4FF9812B7C; Fri, 26 Jan 2024 10:47:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="TVYwDy3F" Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 189E71FA0 for ; Fri, 26 Jan 2024 10:47:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706266050; cv=none; b=V/B/FNAg/uP0noTZmXgQlLV1WwFUYR3MyBSByoyBMsR1whLZBbndfKldoILXgIsE0yHEX85u7lXw1ynzCXz9gpKOzKAf89z3+iIKj/bv26VeCdMw4qMmk3+vixYbjng9IEk09m0mUjLlB5hk7TESrDmA7pxfbTJzv7KAeZsppqM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706266050; c=relaxed/simple; bh=7iGPgXhQzjAMgbbLMGBzDKjvZs6QBwPWWlL95HNkfuo=; h=Message-ID:Date:MIME-Version:Subject:To:CC:References:From: In-Reply-To:Content-Type; b=dysQ4mBg3gFCTpLnCHvXkJC9zsIKcL0OAeQf1NYoGMNpQ2fMEbMwKg3U/ZNKO5S0jSkVhLinL3EVGrvNwvkCzIM8p4+zmPW2x9kySPS6zLj+kMXtwJxvDY+h7IgkW4NxTxFpCUlX9uNdDamAQTdwExFGyYwhHKBblZenjRZTpY0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=TVYwDy3F; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com Received: from pps.filterd (m0279873.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 40Q4OuBC002099; Fri, 26 Jan 2024 10:47:13 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=Dr1b+LNasWBfDiz6qm0FOfD2D0DAEk8L38V0AafYadw=; b=TV YwDy3FFHML3PaoRSDH6ATY6Zx8W/OiAu5hJwCGX0BCFHm/9m9AZ9PDCK8Vsj7pL7 PM7DvyMPnHcxbPpMu6VzFMzPlrryjTihMaeIvTSbI3USy4C/Wp9XAFkBY4ONDAJh idzkegrFBuQA6qJowDwwUTSa9p6uuc2vE8Tg6gLGpFMolMRX1IZ7MPqJiNW0HOjJ yuYYHDZTDc5GaGeK3W5OZtQ5VSmD6csC8kjTyBPBPxb1izB32D948hf3kf4idNl+ SRrExxssctfKIA6tRJF334X9i1LQpQUHC1e6C0Fmvx1lSuLmyxJhDQqdpypQCBuw JOX2wc5OvqNxyCSgOqfg== Received: from nalasppmta03.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3vv1q596vt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 26 Jan 2024 10:47:13 +0000 (GMT) Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA03.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 40QAlCJW031039 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 26 Jan 2024 10:47:12 GMT Received: from [10.216.18.218] (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, 26 Jan 2024 02:47:08 -0800 Message-ID: <5adb12eb-8403-5860-28eb-5f6ab12f3c04@quicinc.com> Date: Fri, 26 Jan 2024 16:17:04 +0530 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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 Content-Language: en-US To: Zach O'Keefe CC: Michal Hocko , , , , , , , , , Axel Rasmussen , Yosry Ahmed , David Rientjes References: <5c7f25f9-f86b-8e15-8603-e212b9911cac@quicinc.com> <342a8854-eef5-f68a-15e5-275de70e3f01@quicinc.com> From: Charan Teja Kalla In-Reply-To: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit 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-ORIG-GUID: juFkEb3_tBv4RmYroSjb6W-T0ad2YZ34 X-Proofpoint-GUID: juFkEb3_tBv4RmYroSjb6W-T0ad2YZ34 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-01-25_14,2024-01-25_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1011 malwarescore=0 mlxscore=0 lowpriorityscore=0 adultscore=0 priorityscore=1501 phishscore=0 mlxlogscore=668 impostorscore=0 bulkscore=0 spamscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2401190000 definitions=main-2401260078 Hi Michal/Zach, On 1/25/2024 10:06 PM, Zach O'Keefe wrote: > Thanks for the patch, Charan, and thanks to Yosry for pointing me towards it. > > I took a look at data from our fleet, and there are many cases on > high-cpu-count machines where we find multi-GiB worth of data sitting > on pcpu free lists at the time of system oom-kill, when free memory > for the relevant zones are below min watermarks. I.e. clear cases > where this patch could have prevented OOM. > > This kind of issue scales with the number of cpus, so presumably this > patch will only become increasingly valuable to both datacenters and > desktops alike going forward. Can we revamp it as a standalone patch? > Glad to see a real world use case for this. We too have observed OOM for every now and then with relatively significant PCP cache, but in all such cases OOM is imminent. AFAICS, Your use case description to be seen like a premature OOM scenario despite lot of free memory sitting on the pcp lists, where this patch should've helped. @Michal: This usecase seems to be a practical scenario that you were asking below. Other concern of racing freeing of memory ending up in pcp lists first -- will that be such a big issue? This patch enables, drain the current pcp lists now that can avoid the oom altogether. If this racing free is a major concern, should that be taken as a separate discussion? Will revamp this as a separate patch if no more concerns here. > Thanks, > Zach > > > On Tue, Nov 14, 2023 at 8:37 AM Charan Teja Kalla > wrote: >> >> Thanks Michal!! >> >> On 11/14/2023 4:18 PM, Michal Hocko wrote: >>>> At least in my particular stress test case it just delayed the OOM as i >>>> can see that at the time of OOM kill, there are no free pcp pages. My >>>> understanding of the OOM is that it should be the last resort and only >>>> after doing the enough reclaim retries. CMIW here. >>> Yes it is a last resort but it is a heuristic as well. So the real >>> questoin is whether this makes any practical difference outside of >>> artificial workloads. I do not see anything particularly worrying to >>> drain the pcp cache but it should be noted that this won't be 100% >>> either as racing freeing of memory will end up on pcp lists first. >> >> Okay, I don't have any practical scenario where this helped me in >> avoiding the OOM. Will comeback If I ever encounter this issue in >> practical scenario. >> >> Also If you have any comments on [PATCH V2 2/3] mm: page_alloc: correct >> high atomic reserve calculations will help me. >> >> Thanks. >>