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=-13.3 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,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 7B386C433E0 for ; Mon, 15 Mar 2021 19:39:29 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 0570064DFD for ; Mon, 15 Mar 2021 19:39:29 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0570064DFD 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 A1B886B0036; Mon, 15 Mar 2021 15:39:28 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9FE006B0071; Mon, 15 Mar 2021 15:39:28 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8BD386B0072; Mon, 15 Mar 2021 15:39:28 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0242.hostedemail.com [216.40.44.242]) by kanga.kvack.org (Postfix) with ESMTP id 710346B0036 for ; Mon, 15 Mar 2021 15:39:28 -0400 (EDT) Received: from smtpin20.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 21CCD180AD820 for ; Mon, 15 Mar 2021 19:39:28 +0000 (UTC) X-FDA: 77923122816.20.7EB4250 Received: from mail-lj1-f182.google.com (mail-lj1-f182.google.com [209.85.208.182]) by imf02.hostedemail.com (Postfix) with ESMTP id C73A3400B20E for ; Mon, 15 Mar 2021 19:24:44 +0000 (UTC) Received: by mail-lj1-f182.google.com with SMTP id f26so17636951ljp.8 for ; Mon, 15 Mar 2021 12:24:44 -0700 (PDT) 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=/f9XDzNIvYjkey3GMR3Z4bha9CeQdt1BP03J0f875v4=; b=PpWndKMOuohcxOMFuTeXlpG64sQCd3ZU/cQ60Wm1qdLeMdXwSwBOaaPIq4BMw+LAS4 KMi2z2s8zzwjzpplYncxfQBebjDw5eXXNOjWrTvwndD6OBstb99cPQXmE5Xor0dHAqTb N7NL2BmcnIfkAqui+DuNLMdOV1LXtEpGLly6qTkfAK1VD0hjDjhbj/tsz8P7dukD1Pwt 03s15ZiJb7Y9vqgw9ZvEOGVFFj6b2G+Tv7Qef2TJekWIrLtUGyxVFKgFd+P10s0CdkZx PbgjJNzidVKLyEJyIfGA0t1M8rSxnGXg+aFtafRdUEkuYLfy1x8yOOqiukrROwasx1lc dsbw== 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=/f9XDzNIvYjkey3GMR3Z4bha9CeQdt1BP03J0f875v4=; b=QIyCuSdymgrXVWVwHR2SHz1rhp3rA/Ro/jHZnSXL7HgBWfxopFe/S65icl5QrK1wSF jXT+z6t8BNCUIbtKtq9qlbjlfYf0ZeWkAlkcrHqzqncnyhwEP0IeH2+YIdqa5+uMWm5w Z2LMA4MMuPgjMjDJw0yUae8n3R9gpme0sL+q5+5KKD9+CbzQJcvolhCPnsdQli5FusVj GeC2jr+nQlRfHILW4u2cFqyKVsCseTpjzMn2tmKBFUMPzEqOKNmquYHWI8VbfHgx8Zux zzzU7P52+56R/VAoPcxdEGxr4mKYBcpOM9nlkjMdgFhlzT7Q7ED/Rns3KOMrppjsc64F omdA== X-Gm-Message-State: AOAM532QAOxoVP4asM4LAG6CKj22JZYyYm10jcsukl6BebeOIe3N3/Kj QJXf4VVT7wNwsEcW+5oyV7iuNwIAvf18yB4LJt/Wxw== X-Google-Smtp-Source: ABdhPJy0NjnN+FMF8APlbSCEIAwZYmvUOqzVQJZCZumFdWQf4p/XUb0N0SlWRyZWxNKLYezMt31oTdWUOKVnhj33+lk= X-Received: by 2002:a2e:9195:: with SMTP id f21mr329002ljg.160.1615836283259; Mon, 15 Mar 2021 12:24:43 -0700 (PDT) MIME-Version: 1.0 References: <85b5f428-294b-af57-f496-5be5fddeeeea@virtuozzo.com> <20210315100942.3cc98bb4@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> In-Reply-To: <20210315100942.3cc98bb4@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> From: Shakeel Butt Date: Mon, 15 Mar 2021 12:24:31 -0700 Message-ID: Subject: Re: [PATCH v2 1/8] memcg: accounting for fib6_nodes cache To: Jakub Kicinski Cc: Vasily Averin , Cgroups , Michal Hocko , Linux MM , Johannes Weiner , Vladimir Davydov , "David S. Miller" , Hideaki YOSHIFUJI , David Ahern Content-Type: text/plain; charset="UTF-8" X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: C73A3400B20E X-Stat-Signature: grdcc9rk71a9woh6ndka59emaroemoo1 Received-SPF: none (google.com>: No applicable sender policy available) receiver=imf02; identity=mailfrom; envelope-from=""; helo=mail-lj1-f182.google.com; client-ip=209.85.208.182 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1615836284-766786 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 Mon, Mar 15, 2021 at 10:09 AM Jakub Kicinski wrote: > > On Mon, 15 Mar 2021 15:23:00 +0300 Vasily Averin wrote: > > An untrusted netadmin inside a memcg-limited container can create a > > huge number of routing entries. Currently, allocated kernel objects > > are not accounted to proper memcg, so this can lead to global memory > > shortage on the host and cause lot of OOM kiils. > > > > One such object is the 'struct fib6_node' mostly allocated in > > net/ipv6/route.c::__ip6_ins_rt() inside the lock_bh()/unlock_bh() section: > > > > write_lock_bh(&table->tb6_lock); > > err = fib6_add(&table->tb6_root, rt, info, mxc); > > write_unlock_bh(&table->tb6_lock); > > > > It this case is not enough to simply add SLAB_ACCOUNT to corresponding > > kmem cache. The proper memory cgroup still cannot be found due to the > > incorrect 'in_interrupt()' check used in memcg_kmem_bypass(). > > To be sure that caller is not executed in process contxt > > '!in_task()' check should be used instead > > Sorry for a random question, I didn't get the cover letter. > > What's the overhead of adding SLAB_ACCOUNT? > The potential overhead is for MEMCG users where we need to charge/account each allocation from SLAB_ACCOUNT kmem caches. However charging is done in batches, so the cost is amortized. If there is a concern about a specific workload then it would be good to see the impact of this patch for that workload. > Please make sure you CC netdev on series which may impact networking.