Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp387125pxb; Wed, 15 Sep 2021 04:32:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxtvXbwNReiWAQdCYUSf/wRILBvp0vP2kRa0sjm3+NKJsTT0L9YzL/4HA3uGmpQIzzZUwJs X-Received: by 2002:a5d:64e5:: with SMTP id g5mr965274wri.282.1631705540677; Wed, 15 Sep 2021 04:32:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631705540; cv=none; d=google.com; s=arc-20160816; b=YjYSawHR9yBBj2OVFggtE4lveVO8L91+1XewlpEZRZGWvHngjL82EKlQ2b5pH2qWMO yl3WY1iXsTir8ogcRLTUKuq2+hsMO5as/IhWPk93O0FJlRxRRDAWsMHkk+b8bsMzmpSE ieNaiTQDjiCr1HezG2S9v6RMyOb2mxAX4onUHcycfuOIExipEXBMrvHUY16bYNA0IrB/ HihS/Z3w2pXgroXL+vP16vVuz9UKPzrixn22bAnUtisWAciHIIWkpOc63Do4p+COqXYW 9/m3O+cAq1MJAx3fB4N1MyaE3I2AiNo3GuyGGh8Z+iQRf0kxaAebYSC64r51c9p5MO2A Wzkg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=UOkCjvFoaNxGNbGFWeeVQVHJtZCjHhgLPxx+uerfl10=; b=L+/hHmVj+PYgXUSK9fW0+M6fQATUR5w5GQk2WDDntgxsZCYhq+WOgDt9jPL94kx4SH Rrz8JpsQIanmqisMkXrbQpWWl+/1+DX8X8AMUwxc9X9fk5bOr1a8Q2MuIrU+crMfSDoN N8b+65Lj0X8EtG7122A8OgzTVjhe1tTiQqQ2JyyI6yjXtBZ4gIa+mT93mry+Ae+cz2fH GQtXodehsa/+ZJaG56XQOVPpmVMZ7V6SRHzLBt2DlgGfyX43GeKMfNZ5bhhvLPPoT/rY +B1r8U39ysEiv0couCaqpISkjjXnlzDyAB4FYamwF4NRs3QCh4SnkZVx5kCM+LUzpahO mtJg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b="HNke4/c6"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=suse.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b6si16332541edu.115.2021.09.15.04.31.55; Wed, 15 Sep 2021 04:32:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b="HNke4/c6"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232675AbhIOLbv (ORCPT + 99 others); Wed, 15 Sep 2021 07:31:51 -0400 Received: from smtp-out1.suse.de ([195.135.220.28]:41842 "EHLO smtp-out1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232526AbhIOLbu (ORCPT ); Wed, 15 Sep 2021 07:31:50 -0400 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 005722207D; Wed, 15 Sep 2021 11:30:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1631705431; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=UOkCjvFoaNxGNbGFWeeVQVHJtZCjHhgLPxx+uerfl10=; b=HNke4/c6CnQ8nnlErjOvekgpXVSQXjWl4Ol2+/tLgrRlknDlrVnGAlJb48fXnI99PKyxch OYd1ItE4KjwfkP1Zku3mE76kBPFNJ8txDsFMjiMkJFJOsTZYn4j5Fetseg8i3S8mO1/f1k /jZcCmJ85qh1RlBqZrqrlIGfiLDUXFU= Received: from suse.cz (unknown [10.100.201.86]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 7DE1EA3BA3; Wed, 15 Sep 2021 11:30:30 +0000 (UTC) Date: Wed, 15 Sep 2021 13:30:27 +0200 From: Michal Hocko To: Feng Tang Cc: David Rientjes , Andrew Morton , Tejun Heo , Zefan Li , Johannes Weiner , Mel Gorman , Vlastimil Babka , linux-mm@kvack.org, cgroups@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v3] mm/page_alloc: detect allocation forbidden by cpuset and bail out early Message-ID: References: <1631590828-25565-1-git-send-email-feng.tang@intel.com> <3bd87d8a-d09e-ac7-1d1d-25ad1b9d5ed9@google.com> <20210915053247.GG56674@shbuild999.sh.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210915053247.GG56674@shbuild999.sh.intel.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed 15-09-21 13:32:47, Feng Tang wrote: > On Tue, Sep 14, 2021 at 05:30:03PM -0700, David Rientjes wrote: [...] > > I'm wondering about a single node nodemask, for example, where all > > ZONE_NORMAL memory is hot-removed. While this is theoretically possible it is highly unlikely to happen. Non movable memory just takes one kernel allocation to prevent any hotremove operation to finish. I have to say I was not aware of the hotplug callback. It all seems rather suspicious. I will have a look. Anyway something worth having covered "just in case". Thanks for pointing it out. > Thanks for the reminding! Yes, memory hot remove can change the > cpuset's effective nodemask, we may need to add similar check inside > cpuset_hotplug_update_tasks() which is called by cpuset_hotplug_workfn(), > something like below? > > diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c > index 7fa633e..d5f6776 100644 > --- a/kernel/cgroup/cpuset.c > +++ b/kernel/cgroup/cpuset.c > @@ -3186,6 +3186,14 @@ static void cpuset_hotplug_update_tasks(struct cpuset *cs, struct tmpmasks *tmp) > cpus_updated = !cpumask_equal(&new_cpus, cs->effective_cpus); > mems_updated = !nodes_equal(new_mems, cs->effective_mems); > > + if (mems_updated && !cpusets_insane_config() && > + movable_only_nodes(new_mems)) { > + static_branch_enable(&cpusets_insane_config_key); > + pr_info("Unsupported (movable nodes only) cpuset configuration detected (nmask=%*pbl) after memory hotplug." > + "Cpuset allocations might fail even with a lot of memory available.\n", > + nodemask_pr_args(new_mems); > + } Please create a helper rather than two copies of the same. Thanks! > + > if (is_in_v2_mode()) > hotplug_update_tasks(cs, &new_cpus, &new_mems, > cpus_updated, mems_updated); > > Thanks, > Feng -- Michal Hocko SUSE Labs