Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp584079ybh; Wed, 18 Mar 2020 05:33:10 -0700 (PDT) X-Google-Smtp-Source: ADFU+vu65QilZh7f2RT2rDVDuTpWa2oG2Gk/Iek06rhL2Bwb/ZoYouJUHdmMIyFNWMZrT3MzocUS X-Received: by 2002:a05:6808:9bb:: with SMTP id e27mr2895959oig.36.1584534790229; Wed, 18 Mar 2020 05:33:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584534790; cv=none; d=google.com; s=arc-20160816; b=lpYQ7DRMWQ7rPVZ48qpPzaZKlbsfqJdIC3QGGBoGASpzA5NaGZmG1s6MMM0Xv4uMKT Ph011I2yUg6OII8hk/DUT8MLbiTvURHnNBA/aVfPFsOOrFK+Xy9gkFHzHAlEfa9LqApv tDmw47AS9q+uINNsAsv4VKyLWv62zktCKZw/F1BpeaHHwbOO53YlqvvDYHrRhjhBYrNo y1aaI5HXYCNoR8ZivYp3N9K/VkXFNKMah6yrMg/vvAka9uqbJ9YH0yrq2xiNzlosmlDH jZC4kc2MnuRShGeHE/QfTSX1TyzxXf37vBMBefznwWSeySW0mpbd1Q2cAW76Kidv/sBu ac0A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=J4S1KIZkd3A7M+OXs6nSrJJ9jI8n39NroLM1YJ8t0Co=; b=MH2o7fHGqW5RH2KBRTixBRYmTkMmqHnJNv2Pj2K33jQfxmjl9O4gxe16iIiNQVMByN Sh5RSP/zg1smA6qdl9x4T3MQwlUx1Q0scL+7OLs5Q5AxNHuqbZ3+FWI9q1qRJgOUFpTx F/VxDYsxq00lvEplE3MDmTOOLXqpjwkRmXGuTsYgg3dM8o6mrv2vnAtig6qB1iE6l/7C 6vDvkm+SmncjxJn/CbMvmHwsgFye4qNXhdeLqtTjNdXvYPXEjscvP92fsMwMXgEDbUT5 G5InqgqkiaSLvEEXHoyhxObV3SNOnVU7Zhsv+Jb6uCxprcjnsytDBz2W03XyFU/gPT0k w+3Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p25si2446382ota.143.2020.03.18.05.32.57; Wed, 18 Mar 2020 05:33:10 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726680AbgCRMbM (ORCPT + 99 others); Wed, 18 Mar 2020 08:31:12 -0400 Received: from mail-wm1-f50.google.com ([209.85.128.50]:39897 "EHLO mail-wm1-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726546AbgCRMbL (ORCPT ); Wed, 18 Mar 2020 08:31:11 -0400 Received: by mail-wm1-f50.google.com with SMTP id f7so3088622wml.4 for ; Wed, 18 Mar 2020 05:31:10 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=J4S1KIZkd3A7M+OXs6nSrJJ9jI8n39NroLM1YJ8t0Co=; b=htVjbyn8VmmtSTQvIrBipu5akQd2fsCkRtmS8WYdznFILk8fJ41L0bdybZi9tVaxWE 38LmGlengTHLnbb8hVRe7LvTAVi4oIJswfd2VtJMSCrQBeQimlNhXYl5AFed2OMd5uil EX4f1d7sMdm1/kE/rds5xTgwQmVDj6tQd0awtFHFQvN5hPzJYNX+CBHftyR3ppNcOX3+ Z8jpAGAR2swPG255i8eOmcnVYtCpT7ulrJylaKqy4vadiMtSIocP41th40KZzs6vCQVH fQYLOkISujQsasDEgcTSU7/FPww3JQZM+go/NGnQx44fsZp3JOSFsXsp3UxtSTEbEGSt CLfQ== X-Gm-Message-State: ANhLgQ0tFe+wsQoQfo0jlMmJTHU00UY895r0kuBog+8CYuzQmpMOB5mK 4/M1wOzFtdxzS/ZbAK8UtUFgovYZ X-Received: by 2002:a1c:3585:: with SMTP id c127mr5018236wma.124.1584534669710; Wed, 18 Mar 2020 05:31:09 -0700 (PDT) Received: from localhost (ip-37-188-180-89.eurotel.cz. [37.188.180.89]) by smtp.gmail.com with ESMTPSA id k126sm3928057wme.4.2020.03.18.05.31.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Mar 2020 05:31:08 -0700 (PDT) Date: Wed, 18 Mar 2020 13:31:07 +0100 From: Michal Hocko To: Roman Gushchin Cc: Andrew Morton , linux-mm@kvack.org, kernel-team@fb.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH] mm: memcg: make memory.oom.group tolerable to task migration Message-ID: <20200318123107.GK21362@dhcp22.suse.cz> References: <20200316223510.3176148-1-guro@fb.com> <20200317075212.GC26018@dhcp22.suse.cz> <20200317183836.GA276471@carbon.DHCP.thefacebook.com> <20200317185529.GV26018@dhcp22.suse.cz> <20200317203645.GC276471@carbon.DHCP.thefacebook.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200317203645.GC276471@carbon.DHCP.thefacebook.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue 17-03-20 13:36:45, Roman Gushchin wrote: [...] > > > And the we can put something like > > > if (WARN_ON_ONCE(!mem_cgroup_is_descendant(memcg, oom_domain))) > > > goto out; > > > to mem_cgroup_get_oom_group? > > > > This would be a user triggerable warning and that sounds like a bad idea > > to me. We should just live with races. The only question I still do not > > have a proper answer for is how much we do care. If we do not care all > > that much about the original memcg then go with your patch. But if we > > want to be slightly more careful then we should note the memcg in > > oom_evaluate_task and use it when killing. > > But it won't close the race, right? > > oom_evaluate_task() can race with a task migration too, so we can record > the old or the new cgroup. Are you sure? I thought that cgroups iterator code would take care of those races. The documentation doesn't tell much in that respect. Maybe it would be good to add a clarification there. > Then I'd stick with my original patch which solves the main problem here: > unnecessary killing of too many tasks. OK, I am fine with that. I couldn't convince myself that the other part of the problem is serious enough. Maybe we will find workloads which do care and we can add that later on. -- Michal Hocko SUSE Labs