Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp3919284ybf; Tue, 3 Mar 2020 15:50:23 -0800 (PST) X-Google-Smtp-Source: ADFU+vs6UlgB6iZnWkxn39NATdRBtQikDbBNjv0C9mF9c3UB5EtqoSCBWrbfW4qbYIerUJoID5Ay X-Received: by 2002:a05:6830:1284:: with SMTP id z4mr263847otp.291.1583279423547; Tue, 03 Mar 2020 15:50:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583279423; cv=none; d=google.com; s=arc-20160816; b=W8FvjG9sOKdMrqqSqi0jS17a4pv0o9li/53JxI8a8Pb33Oj1MTqFBWO5Es3peFSLoL GYIyOUtddj2FZWUXBMCOsL3W+w0Ltm9biDw6GVhTyZA4OwcfoJ9Nh0hnbr0wB7g2i0nz WIrLOloV4QoSdw7aCn+22BAXFKO0TJ15n1AUPJOwu8iuGIQxNhN4M1nZ8gd/YFNbIDZC mrYZCAheaasD9NknUxvwIV+1w6RgEcV0dxly3v7WbsEzBnudtaLDATyRNWQoITdkqXZB lg4w9fGExdPOdejZwOnXfo+UqqVlpNSsfltW8svHfJjyJJviQ25GtOFppBqF2os4aoT7 bKyw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=tpXe9qW1IE+W6FbdZ2WrOfJnBA8frqrFQCxhnKyXLE4=; b=mH/GwJ+RsVv0uON5UFAYDYFG8TbhQ73bU9wG44b5ndvbcbihPGntN7cXylB7HvEoUM Ypv0xmhW1tEQaEAxTXf4G7ivhzrm8LpC/EyojjMttcgYL8rHN3jn4VjF26xSbj8GwT8H LCIrrJu8P4QijRHJGhCZz96Mxc+YmKOqJHrTBkHfRNB5SvCAbx9vOfziGcNsWaMJbgYH +jOCS0twjRg/lr8cKyMUhUlhaZUeB1cDIWwbUS3A4M0JIKW+2ls/XDDn9G2wxdRB3sNg M+XyKb3lKubcSwKD/4SgYgDg7aIIBpowf8haL/Ftwz5jyZyfmUoWwO3ruWNvtxGH4ntl x3JA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=bB6r52TI; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a11si96568otq.101.2020.03.03.15.50.08; Tue, 03 Mar 2020 15:50:23 -0800 (PST) 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; dkim=pass header.i=@google.com header.s=20161025 header.b=bB6r52TI; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727854AbgCCXty (ORCPT + 99 others); Tue, 3 Mar 2020 18:49:54 -0500 Received: from mail-ot1-f66.google.com ([209.85.210.66]:33512 "EHLO mail-ot1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727604AbgCCXty (ORCPT ); Tue, 3 Mar 2020 18:49:54 -0500 Received: by mail-ot1-f66.google.com with SMTP id a20so260241otl.0 for ; Tue, 03 Mar 2020 15:49:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=tpXe9qW1IE+W6FbdZ2WrOfJnBA8frqrFQCxhnKyXLE4=; b=bB6r52TIAf9ibs8y+NORyBaaxS8dDSOoFewL5V+z/CPv0VD4b2OXTG6GjdIJmrw58z cwXa6SOKYzcoE6dWgm+bCSol1ivF2L9qVLVRz3mKzFvrJAPRf4PWTkXNXW/is292Zn74 J55/rf2DmiKqvpVC6Odc7IREGf3IQi86Z6kTQ7sARuwR+Lvq65kG2x/EoNvUplkvFTO8 bSq3pb01X7RoInfsU5ZI55las/N8rTcK8Glm07jN+KgrytBr1AfviEAZU3goLEalPW+n doZIGwWim8QgvhWhdUTNejU9cr0K+fD99+36FFBaMy74hYx5hyy0UMccTYHE1fqqH6cy gT/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=tpXe9qW1IE+W6FbdZ2WrOfJnBA8frqrFQCxhnKyXLE4=; b=sJQ4u8dmMz1JqS9w3emSF5eun71WuBfp6ZOKq16V3xfTOEnvImv553MEIYkbPGmJiD i3/wcYxOuoznTl8iwHsH/PAbESBlr4IcUZrhqVrGeYidWGQyftZAQRRdnuUJgRT7O1zw JKjvnsRHDSn4hEmYUJ0xoyn7McJw1Yi0BW3HLHLW9tfDS4p+Xm/wVXPXqm6pYhvIIcdj BuCr33+LZoEvgIlRbhtyF5/iFj50pxZ/ehCyQV6FAV23YxBGrDPbe1NuHWG5rG3YaGvh KfkKa6G+KIViysVk9UZ7PmEN4dr1vlI4M7mj5Rxrah9BsweMAy9K3+Pxiewd/r/QNfdS hSOw== X-Gm-Message-State: ANhLgQ2m/Hoc2/+E4CqxXyPjXy1VOGrmN77fUmc5BjoYHYFpjD5MW79Y uKlmwBIjoESw8BmgQ19+EBkPRGBnhso/xzM0GIIU+Q== X-Received: by 2002:a9d:664d:: with SMTP id q13mr329754otm.30.1583279393250; Tue, 03 Mar 2020 15:49:53 -0800 (PST) MIME-Version: 1.0 References: <20200302203109.179417-1-shakeelb@google.com> <20200303093251.GD4380@dhcp22.suse.cz> In-Reply-To: <20200303093251.GD4380@dhcp22.suse.cz> From: Shakeel Butt Date: Tue, 3 Mar 2020 15:49:41 -0800 Message-ID: Subject: Re: [PATCH v2] memcg: css_tryget_online cleanups To: Michal Hocko Cc: Roman Gushchin , Johannes Weiner , Andrew Morton , Linux MM , Cgroups , LKML Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Mar 3, 2020 at 1:32 AM Michal Hocko wrote: > > On Mon 02-03-20 12:31:09, Shakeel Butt wrote: > > Currently multiple locations in memcg code, css_tryget_online() is being > > used. However it doesn't matter whether the cgroup is online for the > > callers. Online used to matter when we had reparenting on offlining and > > we needed a way to prevent new ones from showing up. > > > > The failure case for couple of these css_tryget_online usage is to > > fallback to root_mem_cgroup which kind of make bypassing the memcg > > limits possible for some workloads. For example creating an inotify > > group in a subcontainer and then deleting that container after moving the > > process to a different container will make all the event objects > > allocated for that group to the root_mem_cgroup. So, using > > css_tryget_online() is dangerous for such cases. > > > > Two locations still use the online version. The swapin of offlined > > memcg's pages and the memcg kmem cache creation. The kmem cache indeed > > needs the online version as the kernel does the reparenting of memcg > > kmem caches. For the swapin case, it has been left for later as the > > fallback is not really that concerning. > > Could you be more specific about the swap in case please? > With swap accounting enabled, if the memcg of the swapped out page is not online then the memcg extracted from the given 'mm' will be charged and if 'mm' is NULL then root memcg will be charged. However I could not find a code path where the given 'mm' will be NULL for swap-in case. > > > Signed-off-by: Shakeel Butt > > Other than that nothing really jumped at me although I have to confess > that I am far from deeply familiar with the sk_buff charging path. > > Acked-by: Michal Hocko Thanks.