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 4F9BEC76196 for ; Tue, 11 Apr 2023 13:12:40 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E20716B0075; Tue, 11 Apr 2023 09:12:39 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id DD03D6B0078; Tue, 11 Apr 2023 09:12:39 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C9865900003; Tue, 11 Apr 2023 09:12:39 -0400 (EDT) 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 B9AAA6B0075 for ; Tue, 11 Apr 2023 09:12:39 -0400 (EDT) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 79DDEAC197 for ; Tue, 11 Apr 2023 13:12:39 +0000 (UTC) X-FDA: 80669149638.05.8AFBA2A Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by imf09.hostedemail.com (Postfix) with ESMTP id 7540E14000B for ; Tue, 11 Apr 2023 13:12:37 +0000 (UTC) Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b=N3D9s54C; spf=pass (imf09.hostedemail.com: domain of mhocko@suse.com designates 195.135.220.29 as permitted sender) smtp.mailfrom=mhocko@suse.com; dmarc=pass (policy=quarantine) header.from=suse.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1681218757; a=rsa-sha256; cv=none; b=y2RcFqFmYRfpEKT92tPCXQMXAoYIVHEQ5dfD7alfVcSRCMBowIHKkhFpEHgYSHKF6VIjhh IOkqDzBKQb4YtoMiZMRCHrOwf0ijaZILGdkPubfxpUVmlnutCp/CGreyBfP4QsssohmiBx LcyPKJFsb4nWx5CWbZpTXvGfTAePwUo= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b=N3D9s54C; spf=pass (imf09.hostedemail.com: domain of mhocko@suse.com designates 195.135.220.29 as permitted sender) smtp.mailfrom=mhocko@suse.com; dmarc=pass (policy=quarantine) header.from=suse.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1681218757; 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=VNlFRQuYhtU71A5sBtEqauVXSAM4+ELeuv9fRTR/B+8=; b=rT5+eTZFPI/dnUWn1fZFW6DwMCxa9P73DzU4hy+ijjl0bRz0wVHdoHXdeToFoq6CH+Qh1E 9onO47oCocxswln/EdVOKHp8beGxa8zyYovRQCI8YPFYu9ZOkAoEtpaBW3ysVCD2iIuxAy rMddOYV4NjCS0sbV3wm2xenH/cJCBI8= Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id CDE151FD6A; Tue, 11 Apr 2023 13:12:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1681218755; h=from:from:reply-to: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=VNlFRQuYhtU71A5sBtEqauVXSAM4+ELeuv9fRTR/B+8=; b=N3D9s54Cj7iVAGl3df2xdmODccoQe5g3gpxR/8FgOto6W6miPDufLxBAI1dKerUC33V0e3 ZmdpqwbnwZywWA363KMPUG+hVUJK90Uivdmur+G67+EBIcBRhGlxkSg+zch2ZVqdDRD49O qdirTKxhGLmkRu86zzmZkrGX169YhMc= Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id AAB8113519; Tue, 11 Apr 2023 13:12:35 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id DFM+J8NcNWQMLQAAMHmgww (envelope-from ); Tue, 11 Apr 2023 13:12:35 +0000 Date: Tue, 11 Apr 2023 15:12:34 +0200 From: Michal Hocko To: Gang Li Cc: Michal =?iso-8859-1?Q?Koutn=FD?= , Waiman Long , cgroups@vger.kernel.org, linux-mm@kvack.org, rientjes@google.com, Zefan Li , linux-kernel@vger.kernel.org Subject: Re: Re: [PATCH v4] mm: oom: introduce cpuset oom Message-ID: References: <20230411065816.9798-1-ligang.bdlg@bytedance.com> <3myr57cw3qepul7igpifypxx4xd2buo2y453xlqhdw4xgjokc4@vi3odjfo3ahc> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Rspam-User: X-Rspamd-Queue-Id: 7540E14000B X-Rspamd-Server: rspam01 X-Stat-Signature: j4zxo5igyht5equtm39o976xcn3yegkr X-HE-Tag: 1681218757-407107 X-HE-Meta: U2FsdGVkX1/53MQV6t5KSHbj5MFGIpMfS+rIkuHGDCsHzGAgNwY8N0vcGE0fUHElO0/ffTJEDM06WWXUFD70QTm040dYgVXdr7sdGj6jifhXnie3XkqYvpoWlS4WZHymIIKvlqG9RsIHpDaS/DQUIEWLdeviG63Tn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ogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Tue 11-04-23 21:04:18, Gang Li wrote: > > > On 2023/4/11 20:23, Michal Koutný wrote: > > Hello. > > > > On Tue, Apr 11, 2023 at 02:58:15PM +0800, Gang Li wrote: > > > + cpuset_for_each_descendant_pre(cs, pos_css, &top_cpuset) { > > > + if (nodes_equal(cs->mems_allowed, task_cs(current)->mems_allowed)) { > > > + css_task_iter_start(&(cs->css), CSS_TASK_ITER_PROCS, &it); > > > + while (!ret && (task = css_task_iter_next(&it))) > > > + ret = fn(task, arg); > > > + css_task_iter_end(&it); > > > + } > > > + } > > > + rcu_read_unlock(); > > > + cpuset_read_unlock(); > > > + return ret; > > > +} > > > > I see this traverses all cpusets without the hierarchy actually > > mattering that much. Wouldn't the CONSTRAINT_CPUSET better achieved by > > globally (or per-memcg) scanning all processes and filtering with: > > Oh I see, you mean scanning all processes in all cpusets and scanning > all processes globally are equivalent. Why cannot you simple select a process from the cpuset the allocating process belongs to? I thought the whole idea was to handle well partitioned workloads. > > nodes_intersect(current->mems_allowed, p->mems_allowed > > Perhaps it would be better to use nodes_equal first, and if no suitable > victim is found, then downgrade to nodes_intersect? How can this happen? > NUMA balancing mechanism tends to keep memory on the same NUMA node, and > if the selected victim's memory happens to be on a node that does not > intersect with the current process's node, we still won't be able to > free up any memory. AFAIR NUMA balancing doesn't touch processes with memory policies. -- Michal Hocko SUSE Labs