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 56466C27C7A for ; Thu, 17 Aug 2023 08:40:57 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id AD7AE28003A; Thu, 17 Aug 2023 04:40:56 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A878A280039; Thu, 17 Aug 2023 04:40:56 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 976E228003A; Thu, 17 Aug 2023 04:40:56 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 85C39280039 for ; Thu, 17 Aug 2023 04:40:56 -0400 (EDT) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 5297614057B for ; Thu, 17 Aug 2023 08:40:56 +0000 (UTC) X-FDA: 81132951312.25.F279B12 Received: from out-62.mta1.migadu.com (out-62.mta1.migadu.com [95.215.58.62]) by imf15.hostedemail.com (Postfix) with ESMTP id 330A6A0015 for ; Thu, 17 Aug 2023 08:40:53 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=YoBZrjAC; spf=pass (imf15.hostedemail.com: domain of gang.li@linux.dev designates 95.215.58.62 as permitted sender) smtp.mailfrom=gang.li@linux.dev; dmarc=pass (policy=none) header.from=linux.dev ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1692261654; 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=nIphj18RtSktOChYllHuu9FMoXo0StpvUC/Vo4hk6Xc=; b=nY8KB0M6PJH2Gu8NNzsVKnNsR7aY6l/lyLuwuQPXta/opepiiEvqA8GuJzuS9L0XSoGo+I kqH+B8OfXsehnra+fQGJGB8vDyxbJ5UYIMaMrLljbHygRQHE5bsP6O+VUDZuUgdcWHsNwQ rXj+kTu704hgrjy6szcpRwcefbCeNXs= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1692261654; a=rsa-sha256; cv=none; b=ZS4dJ17G4puH4hAA8zHozwH/WUhd31zd1SIP5kcBcJ6aO62bowElvgQsuB0Sc0/kuqz24n coraWVErZlwVFLrNIA76vZX71OC2jEtetIzhvOdJCb167ro4u7a5vtjmGP36V0Z950Br/X 3xkKdnoJWOmiYKjaEqCngrnd1T6xrDY= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=YoBZrjAC; spf=pass (imf15.hostedemail.com: domain of gang.li@linux.dev designates 95.215.58.62 as permitted sender) smtp.mailfrom=gang.li@linux.dev; dmarc=pass (policy=none) header.from=linux.dev Message-ID: <9ba0de31-b9b8-fb10-011e-b24e9dba5ccd@linux.dev> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1692261651; h=from:from: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; bh=nIphj18RtSktOChYllHuu9FMoXo0StpvUC/Vo4hk6Xc=; b=YoBZrjACVksy7EYTvMwTn/K0VhdgDsK1M9FMSZYMJ2ji5UPgut5HZmPHbNhafQHl9OVfRz hutBe++EfG9ZTsLKVWqvz45nyDwaBBdqTcSBVJQZxhkor7Bdr+Oqmg58p50bHfR9dy1AkI zpiGdJyUq2jAD+qB2jRuuxdP/waMHIg= Date: Thu, 17 Aug 2023 16:40:46 +0800 MIME-Version: 1.0 Subject: Re: [PATCH v4] mm: oom: introduce cpuset oom Content-Language: en-US To: Michal Hocko Cc: Waiman Long , cgroups@vger.kernel.org, linux-mm@kvack.org, rientjes@google.com, Zefan Li , linux-kernel@vger.kernel.org References: <20230411065816.9798-1-ligang.bdlg@bytedance.com> X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Gang Li In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_OUT X-Stat-Signature: e3n3x7wcw8xuxxnrgq9yk14yazkeooj3 X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: 330A6A0015 X-Rspam-User: X-HE-Tag: 1692261653-19351 X-HE-Meta: U2FsdGVkX1/s5ElPd1QoumUeFvv2VWFSS+AgmejIeJ8R4DL7LiyBBUNL/6ghv8I3WQqeZY4t4Zc83eN9Q7Xo1hJebboFnWb7i2rZ/He/1ZQDLNRBIt37MiUvgWTGMcEe2LLfWkpRJ272mcFDi9uiQ6CoJYzqoF4BGuaVua6z5V3Flcc7ht8PqWSZCROA6rnQUw0RpHzZ1n62PWtHl7OBbHlzJg569yTd/QXeAQOKor2Z+wLLWj2Nfjw2RWkCJr8OtC7bSQREnSMADyEeShGSBpA4B/SovMJO7b2be2QkQA/D8DrmQopiTWR2gnyEPDXXacGFr2o7LQGBRurUV13rTvyU/g5L5Deac5K6QGG7CDTm9T4D/Fy986Bb/Z0wfzc8MLQnGe+jccpd+iQEWYOyaiVwjulUtjFgMADrx/2idpP5G0NRG4GcFnJIt1OkuRWLPMv1vrIEgMzFpTlAEf+M5rnMIfLS9BsyQISDhIVkXFr2vD+2N1PAq4P6Y1npgfTBJLLSdCSSvhvdjU4jPV6EhfmPb0KggInZ1B6MiHebyyKoS/fNbUznXyrLsab/jQxir6+vYyslXzjpel9n25zG2aHQuiWrt9QomRG4IF9lXkizYwHeFK6gOHopG5fPg/Admg6+Xu/RdDOYakGHG3p6skJvdXJnHmrzETH7Py4P6dizPrZ3K13HDP2gpvOSisLyTj4IONrp6UokqRc8K5oyt8MDUT22eXmARBZXV9T6a76vG8Xyqb5iExFHH4xzoTk1JRVSofPl85AT36WNAh/L80Sm2oj5rchsLuoasZLxM3mBpuOSJgD4aO7S/BhV/fcp6DwLXesWGlxp4MsxRFzoVaeIO2EiEgRqVyjg83mYh2/n69DWoYEsEyUGeUeb8Rbb7BuF3JrBJ6Poa/3pbBgVTtHJofYYGgqbv2Sh84tUGTnVwT+DHEvFf4lNQIEnMmKeQDtIq6TaBNt3SHiTKl5 IaGNpZBM qM08jdr34yIUDoUM5e+FXsAF0OHYuTuQc57Rgau0w1oThx/TGf1rswHLdkCGaG+3pc/EfiyoBAOluMQLEtMd8+Q1+mQ== 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: Apologize for the extremely delayed response. I was previously occupied with work unrelated to the Linux kernel. On 2023/4/11 22:36, Michal Hocko wrote: > I believe it still wouldn't hurt to be more specific here. > CONSTRAINT_CPUSET is rather obscure. Looking at this just makes my head > spin. > /* Check this allocation failure is caused by cpuset's wall function */ > for_each_zone_zonelist_nodemask(zone, z, oc->zonelist, > highest_zoneidx, oc->nodemask) > if (!cpuset_zone_allowed(zone, oc->gfp_mask)) > cpuset_limited = true; > > Does this even work properly and why? prepare_alloc_pages sets > oc->nodemask to current->mems_allowed but the above gives us > cpuset_limited only if there is at least one zone/node that is not > oc->nodemask compatible. So it seems like this wouldn't ever get set > unless oc->nodemask got reset somewhere. This is a maze indeed.Is there In __alloc_pages: ``` /* * Restore the original nodemask if it was potentially replaced with * &cpuset_current_mems_allowed to optimize the fast-path attempt. */ ac.nodemask = nodemask; page = __alloc_pages_slowpath(alloc_gfp, order, &ac); ``` __alloc_pages set ac.nodemask back to mempolicy before call __alloc_pages_slowpath. > any reason why we cannot rely on __GFP_HARWALL here? Or should we In prepare_alloc_pages: ``` if (cpusets_enabled()) { *alloc_gfp |= __GFP_HARDWALL; ... } ``` Since __GFP_HARDWALL is set as long as cpuset is enabled, I think we can use it to determine if we are under the constraint of CPUSET. But I have a question: Why we always set __GFP_HARDWALL when cpuset is enabled, regardless of the value of cpuset.mem_hardwall? Thanks, Gang Li