Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp110327imm; Tue, 18 Sep 2018 17:46:17 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZk98Ijh1+bUv6gX8Ahg0yC1oCL0P4WoKgpQ+DFsP9u5e+pYGEJyHlV5JJLjjBHiBdaqkSW X-Received: by 2002:a62:20f:: with SMTP id 15-v6mr33518925pfc.100.1537317977309; Tue, 18 Sep 2018 17:46:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537317977; cv=none; d=google.com; s=arc-20160816; b=TqkMkU87dwho9mDsmm2Gf8M0b/mtnLTSWo0URXIfVM3DRgDOdHDE9d7vx4kjCOKf5+ ehFEkE9HDRTyxxmV33Kd9fMYOKIupi5Ca43df7AbqWHqZ1djoq92HLcSq0ajnFkBmcAk mZ3w2N0usNT9rqr48SgU67ui55z/doNpaAj0vDPXSEv2zvT+U/e3m6WlGKR5FWbgD7Sq AsqrGcsKc/gbXD4FGS98NiGIoNMhOlL59moYTbFb16+X1uMoIZCHUZfOzCVsGtRbemN9 wyDn+1kfxnkFPed7ALs28BaO96mtyYZkRCiL2F7i0ALzzoOwLicSo2O0SH+0w+ABsDCS WGTg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:from:subject:mime-version :message-id:date:dkim-signature; bh=dPLvabeEu2R5NLjbgna2in9ApyNxHhQTFLi6gYIcZD0=; b=S1Ri/fk5S6b3UFMucuU+cL3r4Cq+0iDpCys7wvTAivSgd6rsdEjiLgbPk+Gy5UMESq cIT7l3ISlNSrzGKa7qptDt+R6OQWjVqjJJeRee90AIeBBqrUqbS7hybQ0nCxkP6DM7DU 2Zv1Ern6Z0zlaquohczrqpEdIbHkNzxOl9I06xbWPa7aa4UwanEFE2OQ8SORJYbu6ftj s8sivdV69Dn+3NLQNwcKslJ+IYq21aNYiFE1BfrfiIGjlnDIlCLlJINpe4odrlKv6z1V LTqtJq197a7xOi/9yBJPr0ksrO7/OqIOHzsfMvdW5WoxkqOdxGwsUbqbwiGQ+ZlQ6eur Ao6Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=D9KTvBvr; 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 e14-v6si19319011pgg.345.2018.09.18.17.46.01; Tue, 18 Sep 2018 17:46:17 -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; dkim=pass header.i=@google.com header.s=20161025 header.b=D9KTvBvr; 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 S1730703AbeISGUX (ORCPT + 99 others); Wed, 19 Sep 2018 02:20:23 -0400 Received: from mail-yw1-f73.google.com ([209.85.161.73]:33134 "EHLO mail-yw1-f73.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727686AbeISGUW (ORCPT ); Wed, 19 Sep 2018 02:20:22 -0400 Received: by mail-yw1-f73.google.com with SMTP id y137-v6so1793321ywy.0 for ; Tue, 18 Sep 2018 17:45:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:message-id:mime-version:subject:from:to:cc; bh=dPLvabeEu2R5NLjbgna2in9ApyNxHhQTFLi6gYIcZD0=; b=D9KTvBvrrAn23w6+nsWFdBhh5C7g8llWsnMC/BzXW0nGAXspOy4e9BubHJLItqLxt5 nbZlHvMY08B0mvPSdc/43Vf21U8YDgbIBpJBLb+PA7eg03ur18PwVxfnbekEvNqXyK6m zKYVbVPRC4QTO3I+KOQ2NESTqBDI5VgcuP+/ocHFqQzGJfiR2Jfr/n4iXqS1xacLOskx BXLhnwKFNv5XEYvMkiU+FgdtXU2sg8RkXl9XNKHdl+DnQFvnfRhSlZRxAzLerEvninOv sdO2jN0nCRQJeKEGCDI6500p8Ca3xckLP6psNtZBY0Ag9FR1m0VYeviPkbi+MxKiNwDS eDyg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:message-id:mime-version:subject:from:to:cc; bh=dPLvabeEu2R5NLjbgna2in9ApyNxHhQTFLi6gYIcZD0=; b=U5PhDXiDVS7mbxyecpoQJ6w1B4RmUYTE1fvBytxYgUNCIqjWle2m9vmTcxSvftomrn +ipr/N00Os0Lu6lmrx1myxCibPwelpXYiUO1qAjEfMjGx//lS8498DZMZ2pYvm/5+xNm 207cocrjqataIUMVu3EhLx/aJufU2xLHWBds6LTBnVmIpSDbPJalA7irtrl7XGvSvBBY gnNZazGXhj/AfTEPpvW04FdMuL4YjcYB/4qWfGLBXQyYCy2UgK3RVq7SYyz5njb8PhjS KKhEYR7xbdqNvvlJIPYHT1syu9/g633Gf78l64aZI2VAs9aQNjF/yh/k2KZDwjmo7kRJ D8iA== X-Gm-Message-State: APzg51DCv29WO/0j4uOTpQw8b/lQotVT/Ppx2MWAHArWx2BxnScdjYIs pM2rxMVAxlZQfb4mo7mIGsLHKzCaiUTVlQ== X-Received: by 2002:a81:180b:: with SMTP id 11-v6mr3712124ywy.19.1537317911673; Tue, 18 Sep 2018 17:45:11 -0700 (PDT) Date: Tue, 18 Sep 2018 17:45:01 -0700 Message-Id: <20180919004501.178023-1-shakeelb@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.19.0.397.gdd90340f6a-goog Subject: [PATCH] memcg: remove memcg_kmem_skip_account From: Shakeel Butt To: Johannes Weiner , Michal Hocko , Vladimir Davydov , Andrew Morton , Greg Thelen Cc: linux-mm@kvack.org, cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, Shakeel Butt 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 The flag memcg_kmem_skip_account was added during the era of opt-out kmem accounting. There is no need for such flag in the opt-in world as there aren't any __GFP_ACCOUNT allocations within memcg_create_cache_enqueue(). Signed-off-by: Shakeel Butt --- include/linux/sched.h | 3 --- mm/memcontrol.c | 24 +----------------------- 2 files changed, 1 insertion(+), 26 deletions(-) diff --git a/include/linux/sched.h b/include/linux/sched.h index 977cb57d7bc9..c30e3cd4b81c 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -723,9 +723,6 @@ struct task_struct { #endif #ifdef CONFIG_MEMCG unsigned in_user_fault:1; -#ifdef CONFIG_MEMCG_KMEM - unsigned memcg_kmem_skip_account:1; -#endif #endif #ifdef CONFIG_COMPAT_BRK unsigned brk_randomized:1; diff --git a/mm/memcontrol.c b/mm/memcontrol.c index e79cb59552d9..bde698a0bb99 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -2460,7 +2460,7 @@ static void memcg_kmem_cache_create_func(struct work_struct *w) /* * Enqueue the creation of a per-memcg kmem_cache. */ -static void __memcg_schedule_kmem_cache_create(struct mem_cgroup *memcg, +static void memcg_schedule_kmem_cache_create(struct mem_cgroup *memcg, struct kmem_cache *cachep) { struct memcg_kmem_cache_create_work *cw; @@ -2478,25 +2478,6 @@ static void __memcg_schedule_kmem_cache_create(struct mem_cgroup *memcg, queue_work(memcg_kmem_cache_wq, &cw->work); } -static void memcg_schedule_kmem_cache_create(struct mem_cgroup *memcg, - struct kmem_cache *cachep) -{ - /* - * We need to stop accounting when we kmalloc, because if the - * corresponding kmalloc cache is not yet created, the first allocation - * in __memcg_schedule_kmem_cache_create will recurse. - * - * However, it is better to enclose the whole function. Depending on - * the debugging options enabled, INIT_WORK(), for instance, can - * trigger an allocation. This too, will make us recurse. Because at - * this point we can't allow ourselves back into memcg_kmem_get_cache, - * the safest choice is to do it like this, wrapping the whole function. - */ - current->memcg_kmem_skip_account = 1; - __memcg_schedule_kmem_cache_create(memcg, cachep); - current->memcg_kmem_skip_account = 0; -} - static inline bool memcg_kmem_bypass(void) { if (in_interrupt() || !current->mm || (current->flags & PF_KTHREAD)) @@ -2531,9 +2512,6 @@ struct kmem_cache *memcg_kmem_get_cache(struct kmem_cache *cachep) if (memcg_kmem_bypass()) return cachep; - if (current->memcg_kmem_skip_account) - return cachep; - memcg = get_mem_cgroup_from_current(); kmemcg_id = READ_ONCE(memcg->kmemcg_id); if (kmemcg_id < 0) -- 2.19.0.397.gdd90340f6a-goog