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=-8.5 required=3.0 tests=INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham 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 81A83C43603 for ; Fri, 6 Dec 2019 08:17:14 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 4B14C2467A for ; Fri, 6 Dec 2019 08:17:14 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4B14C2467A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id D5AD36B14CC; Fri, 6 Dec 2019 03:17:13 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id D0B686B14CD; Fri, 6 Dec 2019 03:17:13 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C216C6B14CE; Fri, 6 Dec 2019 03:17:13 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0057.hostedemail.com [216.40.44.57]) by kanga.kvack.org (Postfix) with ESMTP id ACFD16B14CC for ; Fri, 6 Dec 2019 03:17:13 -0500 (EST) Received: from smtpin28.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with SMTP id 5348B181AEF1F for ; Fri, 6 Dec 2019 08:17:13 +0000 (UTC) X-FDA: 76234011546.28.duck16_21e3407a6b93d X-HE-Tag: duck16_21e3407a6b93d X-Filterd-Recvd-Size: 4324 Received: from mail-wr1-f67.google.com (mail-wr1-f67.google.com [209.85.221.67]) by imf42.hostedemail.com (Postfix) with ESMTP for ; Fri, 6 Dec 2019 08:17:12 +0000 (UTC) Received: by mail-wr1-f67.google.com with SMTP id w15so6774247wru.4 for ; Fri, 06 Dec 2019 00:17:12 -0800 (PST) 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:user-agent; bh=2ba4Nt9WY6yvIikHrTS1xoSBFk9RdJgbhCF3yF6te8s=; b=rargXyWnlePGV3Vvun14K/i+IkofrPYg9HkaeykOhSdk94mHqxfiHHLAL5XOL9IpwW lsO34UG9siiSTpwocOBZvPMlkf5PxTJn9Cg3ZA9Di6alriu8ryQAPmMhD+iBo9Q2bCnL TUK/Dk3/TdlhVZY5uUgdKrPfouaSx52iZBkjlF8/KnKRoox9or1OnACfK/+py/5yAOZG VXdeVufrAuCtACfVCRHZN0FBtKOLhNHM+zmq+8XsqzrXA7I79XlbKc8bRg21qwJufPlu HQf8yfm+/hGGpnkymjUijRnhQk44nbWnUdoTANL5ZWFpTQjC7IHO8rSC30PDd60qQVc2 2lFw== X-Gm-Message-State: APjAAAULHyAoxFiDyuSraaNFbh523RUBAzIpwpDatclL65sLVpbj4lA2 /ZcMvp8r0lLevXwCzKGMcyuNOeow X-Google-Smtp-Source: APXvYqz7pdRuocMu/w2UUxNUvWadUbptDhdAP1Ezq/w2Mu1TsFypaAE46oXMVBQg8qHcIzOmid5Tng== X-Received: by 2002:adf:fc08:: with SMTP id i8mr2462382wrr.82.1575620231692; Fri, 06 Dec 2019 00:17:11 -0800 (PST) Received: from localhost (ip-37-188-170-11.eurotel.cz. [37.188.170.11]) by smtp.gmail.com with ESMTPSA id v4sm3881781wml.2.2019.12.06.00.17.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Dec 2019 00:17:10 -0800 (PST) Date: Fri, 6 Dec 2019 09:17:10 +0100 From: Michal Hocko To: Shakeel Butt Cc: Andrew Morton , Roman Gushchin , linux-mm@kvack.org, Johannes Weiner , linux-kernel@vger.kernel.org Subject: Re: [PATCH] memcg: account security cred as well to kmemcg Message-ID: <20191206081710.GK28317@dhcp22.suse.cz> References: <20191205223721.40034-1-shakeelb@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191205223721.40034-1-shakeelb@google.com> User-Agent: Mutt/1.10.1 (2018-07-13) 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 Thu 05-12-19 14:37:21, Shakeel Butt wrote: > The cred_jar kmem_cache is already memcg accounted in the current > kernel but cred->security is not. Account cred->security to kmemcg. > > Recently we saw high root slab usage on our production and on further > inspection, we found a buggy application leaking processes. Though that > buggy application was contained within its memcg but we observe much > more system memory overhead, couple of GiBs, during that period. This > overhead can adversely impact the isolation on the system. One of source > of high overhead, we found was cred->secuity objects. I am not familiar with this area much. What is the timelife of these objects? Do they go away with a task allocating them? > Signed-off-by: Shakeel Butt > > --- > kernel/cred.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/kernel/cred.c b/kernel/cred.c > index c0a4c12d38b2..9ed51b70ed80 100644 > --- a/kernel/cred.c > +++ b/kernel/cred.c > @@ -223,7 +223,7 @@ struct cred *cred_alloc_blank(void) > new->magic = CRED_MAGIC; > #endif > > - if (security_cred_alloc_blank(new, GFP_KERNEL) < 0) > + if (security_cred_alloc_blank(new, GFP_KERNEL_ACCOUNT) < 0) > goto error; > > return new; > @@ -282,7 +282,7 @@ struct cred *prepare_creds(void) > new->security = NULL; > #endif > > - if (security_prepare_creds(new, old, GFP_KERNEL) < 0) > + if (security_prepare_creds(new, old, GFP_KERNEL_ACCOUNT) < 0) > goto error; > validate_creds(new); > return new; > @@ -715,7 +715,7 @@ struct cred *prepare_kernel_cred(struct task_struct *daemon) > #ifdef CONFIG_SECURITY > new->security = NULL; > #endif > - if (security_prepare_creds(new, old, GFP_KERNEL) < 0) > + if (security_prepare_creds(new, old, GFP_KERNEL_ACCOUNT) < 0) > goto error; > > put_cred(old); > -- > 2.24.0.393.g34dc348eaf-goog > -- Michal Hocko SUSE Labs