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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2C7D5C27C7A for ; Thu, 17 Aug 2023 08:41:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348999AbjHQIlI (ORCPT ); Thu, 17 Aug 2023 04:41:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56686 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349104AbjHQIlE (ORCPT ); Thu, 17 Aug 2023 04:41:04 -0400 Received: from out-46.mta1.migadu.com (out-46.mta1.migadu.com [95.215.58.46]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EBEC630EA for ; Thu, 17 Aug 2023 01:40:53 -0700 (PDT) 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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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