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 X-Spam-Level: X-Spam-Status: No, score=-11.4 required=3.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C74E9C3F2C6 for ; Tue, 3 Mar 2020 23:49:55 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 7F3C420842 for ; Tue, 3 Mar 2020 23:49:55 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="bB6r52TI" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7F3C420842 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 19D916B006C; Tue, 3 Mar 2020 18:49:55 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 14E9E6B006E; Tue, 3 Mar 2020 18:49:55 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 03E256B0070; Tue, 3 Mar 2020 18:49:55 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0204.hostedemail.com [216.40.44.204]) by kanga.kvack.org (Postfix) with ESMTP id DFC306B006C for ; Tue, 3 Mar 2020 18:49:54 -0500 (EST) Received: from smtpin16.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 8BF07181AC9CB for ; Tue, 3 Mar 2020 23:49:54 +0000 (UTC) X-FDA: 76555696308.16.dress63_39630b33cef47 X-HE-Tag: dress63_39630b33cef47 X-Filterd-Recvd-Size: 4594 Received: from mail-ot1-f67.google.com (mail-ot1-f67.google.com [209.85.210.67]) by imf48.hostedemail.com (Postfix) with ESMTP for ; Tue, 3 Mar 2020 23:49:54 +0000 (UTC) Received: by mail-ot1-f67.google.com with SMTP id b3so242478otp.4 for ; Tue, 03 Mar 2020 15:49:54 -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=rOooy53Virw86bWzV9l66WFjS12PvcRKWxZY7D8Do8A0sCNi71r8nHsbLtXGnh/ZVG pTspOih17Hut4Up6TvquvaeulOwQ0J5R4Y+IWjaRaVi1MArxROqR7zdPYl4mJB6mFEAl in2sC10b+oA3m5WFOvvCMSZddJb/rLPRrtax6FtwKl5orf5mi47XMALaJw46uYdYtgC5 rgdxmGKs/w0b73svAscPJeszHBMjGqfSI+BI+BKPsi14mySQXZTZrLw9k+R+tLmhvCHr vRspoFyT6xQXaOKKK2A7iqVVhPyhr5il0sNPba08yVEm4HIfBCbh1Rc8JsNKVL4k43St IP3w== X-Gm-Message-State: ANhLgQ2wqanN5R+PZIO7yOapOegTDqUiGBni7i9HjXYS5xKI/6zI5A+C 5XxpSrWiIopmxyqHF9PftbiskuiIB70jdapgU0rHKw== X-Google-Smtp-Source: ADFU+vu5NG+LHZgFGYQ4CEDf0TzVyEVrAmHZbBF/cGdeYsoE/2mnZSmIsLY7rEqxxdjQqEx7kSxEZ5YVlstsYogMaFY= 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" X-Bogosity: Ham, tests=bogofilter, 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, 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.