From patchwork Thu May 10 09:53:45 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kirill Tkhai X-Patchwork-Id: 10391545 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 6DB0560353 for ; Thu, 10 May 2018 09:53:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5BACC289BA for ; Thu, 10 May 2018 09:53:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4F4A6289C5; Thu, 10 May 2018 09:53:58 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A6A11289BE for ; Thu, 10 May 2018 09:53:57 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 037066B05EB; Thu, 10 May 2018 05:53:56 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id F2AFA6B05ED; Thu, 10 May 2018 05:53:55 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DF3316B05EE; Thu, 10 May 2018 05:53:55 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-it0-f71.google.com (mail-it0-f71.google.com [209.85.214.71]) by kanga.kvack.org (Postfix) with ESMTP id ADBAA6B05EB for ; Thu, 10 May 2018 05:53:55 -0400 (EDT) Received: by mail-it0-f71.google.com with SMTP id c137-v6so1693702ith.3 for ; Thu, 10 May 2018 02:53:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:dkim-signature:subject:from:to:date:message-id :in-reply-to:references:user-agent:mime-version :content-transfer-encoding:spamdiagnosticoutput :spamdiagnosticmetadata; bh=Ujn1h/KseB3zgJx/e57Tug8mCXoI+0upRyN5+30U2uQ=; b=ParZWfZrdLAhtksxs4le2ucZyHCuEuwu9yZZRx/RJIflU6qG6UFX9JVCJ3P6GK3lRH OjYwxVh7xA4JARpUztHJo6NoSG1ex5E5rS4w45N0f5UOlZDJlIeENpAjgtoLzeCyGb5e Z8Z71/cyH+HJtDW1tjm+VMMOgbRUyKT6i96zknU6ZgZpnJhKEKqRFVR6tYzJGXAavieC bUzFzPLJkix0Log6PKAxxNKFAViGBfQ5mtK9CzBeRX9TSCq3gkt+t4swMSs1BN7F4l1S LEpurso9RPB+EWfh4xuTXSOmxzkV0ylOzCYqRbDRGmywPOGBvAhr8hjUXdsLIVcgxZ19 COZQ== X-Gm-Message-State: ALKqPweV7Jhlm80KU06B6cbrpWqi2ecgmd/Bvd477E2kH19MZpGIXJoY vM581vutECBlVc4lQvCXIGZ92DcxvOP3zAwZ1al6v9BgMDbT0LkqvrPr/eLFe+2wbmX92kb38o4 gazlAD1Hpj3p/m6zUg3khZMsjONjcbSAZmXcJVGKyJslCQpBsc+AZd5SYPU2l7vHD9g== X-Received: by 2002:a24:7d0f:: with SMTP id b15-v6mr996132itc.135.1525946035453; Thu, 10 May 2018 02:53:55 -0700 (PDT) X-Google-Smtp-Source: AB8JxZr1S6TAsgMsdIZ2FBb/lU5gFqo8L33wy2Ch7ib7T7nBFh0a7LtfB5mCtCw/lyxh1Nwv942K X-Received: by 2002:a24:7d0f:: with SMTP id b15-v6mr996107itc.135.1525946034657; Thu, 10 May 2018 02:53:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525946034; cv=none; d=google.com; s=arc-20160816; b=xnJSFJWOqKQ/ULNkIczXL2Jr1AMtOjqEEiTAyM0sh4Rcb5N73oFdIf1BZ+QVIrGWFv ZFl2rZji2k1I0KTcTWtM/9c1dOOSH7vyJIERlJxf8MKN9tYr3YwHE7tBXLwIiWU4G0S3 R52qHEpMIiHjumNZAd2XUleZxdnlAFDGZ2qk+wLGiFMSk1CRSPbXTHqDNQpP0nxCSvym ZXWGFbj1kWbIc9F9LVgGMi7megpZuD5UVwjAS8XLoUv0+bsdS2klC6jparPD2p80Xg2W Yzd0AS171uFaj+/KoNRIYamXuKe5mc9VjbQ2CWPJsGDD2SnF/3f/hFcUX7mhhu4/AY7X clOg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=spamdiagnosticmetadata:spamdiagnosticoutput :content-transfer-encoding:mime-version:user-agent:references :in-reply-to:message-id:date:to:from:subject:dkim-signature :arc-authentication-results; bh=Ujn1h/KseB3zgJx/e57Tug8mCXoI+0upRyN5+30U2uQ=; b=fZIfELZDP1hfIAYbSIQgzZGdBSINkCLNIpBRC1wA6OgeMAVTFUjswrQkuTu3oIfZIz B//KQTwCDpvJ6CTa8TIc39SueLqGY5RZRjqEELI66gYZit16njE3Q089bfeccJFnvYdZ mxBWpycm/5Po8keTl2RpwAaU5MnBPluSbHJ/FeQmG5qQDgdIflPkrBfyArLY0b5lxWtv F5ujUT6aOvLP3yd6A8BsnfeB6o3ne1/NL8uvbbTCr5RxG5SMyEQok/qL+0UFfFr1tfm3 srLGjW3qoqmhTA9tX1gZiIXuVlFAhRidEgIKN2ESCfgXtryic8Fey85zEvE3RaU7JGWV J3sQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=selector1 header.b=OyKtzM3l; spf=pass (google.com: domain of ktkhai@virtuozzo.com designates 40.107.2.97 as permitted sender) smtp.mailfrom=ktkhai@virtuozzo.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=virtuozzo.com Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-eopbgr20097.outbound.protection.outlook.com. [40.107.2.97]) by mx.google.com with ESMTPS id g10-v6si376811iob.72.2018.05.10.02.53.54 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 10 May 2018 02:53:54 -0700 (PDT) Received-SPF: pass (google.com: domain of ktkhai@virtuozzo.com designates 40.107.2.97 as permitted sender) client-ip=40.107.2.97; Authentication-Results: mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=selector1 header.b=OyKtzM3l; spf=pass (google.com: domain of ktkhai@virtuozzo.com designates 40.107.2.97 as permitted sender) smtp.mailfrom=ktkhai@virtuozzo.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=virtuozzo.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=Ujn1h/KseB3zgJx/e57Tug8mCXoI+0upRyN5+30U2uQ=; b=OyKtzM3lTvHdWJDX2zr8XWi3XoHLwppLOeXtrye/JNz78ZeK4J/V8rxI0voeNJHkU/rdMhmBs1k+BY+Ba6MfgsYoSh/jJAOBbvpTJMbnedCk/CbS0v654MjndCKE9BVJzDVS6LfRnUCV4M0BJ9+6cbJ/AMLDmVGxkscjwyNKd1g= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=ktkhai@virtuozzo.com; Received: from localhost.localdomain (195.214.232.6) by VI1PR0801MB1342.eurprd08.prod.outlook.com (2603:10a6:800:3a::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.735.17; Thu, 10 May 2018 09:53:48 +0000 Subject: [PATCH v5 10/13] mm: Set bit in memcg shrinker bitmap on first list_lru item apearance From: Kirill Tkhai To: akpm@linux-foundation.org, vdavydov.dev@gmail.com, shakeelb@google.com, viro@zeniv.linux.org.uk, hannes@cmpxchg.org, mhocko@kernel.org, ktkhai@virtuozzo.com, tglx@linutronix.de, pombredanne@nexb.com, stummala@codeaurora.org, gregkh@linuxfoundation.org, sfr@canb.auug.org.au, guro@fb.com, mka@chromium.org, penguin-kernel@I-love.SAKURA.ne.jp, chris@chris-wilson.co.uk, longman@redhat.com, minchan@kernel.org, ying.huang@intel.com, mgorman@techsingularity.net, jbacik@fb.com, linux@roeck-us.net, linux-kernel@vger.kernel.org, linux-mm@kvack.org, willy@infradead.org, lirongqing@baidu.com, aryabinin@virtuozzo.com Date: Thu, 10 May 2018 12:53:45 +0300 Message-ID: <152594602582.22949.2526776640167844592.stgit@localhost.localdomain> In-Reply-To: <152594582808.22949.8353313986092337675.stgit@localhost.localdomain> References: <152594582808.22949.8353313986092337675.stgit@localhost.localdomain> User-Agent: StGit/0.18 MIME-Version: 1.0 X-Originating-IP: [195.214.232.6] X-ClientProxiedBy: AM0PR06CA0052.eurprd06.prod.outlook.com (2603:10a6:208:aa::29) To VI1PR0801MB1342.eurprd08.prod.outlook.com (2603:10a6:800:3a::28) X-MS-PublicTrafficType: Email X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(4534165)(7168020)(4627221)(201703031133081)(201702281549075)(5600026)(2017052603328)(7153060)(7193020); SRVR:VI1PR0801MB1342; X-Microsoft-Exchange-Diagnostics: 1; VI1PR0801MB1342; 3:Hpz5c2YXGdt+dmsk2GlXpQ9g3qjHa2xKa2IKa+VeF10S5brxny0iYZYMld+bunD+S2OH2GxQHrE0FLt3HGrulwIeFqklU1CqFKhWEX+pF59takvFGLbBU2jrds9mujCCqCvtyjtb8KQuvkjpDsnV10AUyQbmPC+q87k1vyZPPjBfZB/sgeyMLt9nh5Eobgtbzk3qfhYnOWxIweis9D6lxNgHx4AXoOC8wWo9X5EJuQbW/LSNhiUi4OmbG7rllU1R;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AQJ7Icee7m+w38972c5QGuD3+LL+Gx+NaoCz3drj4L9A94lvcV+ciFv9gz5DqGwymGLUejZn9RtJK3gvgvLKMZXhV7X; 4:QrywgOJauQ+VYqLQuYzbLZrA5KIu4jSh2KqXksRPrcdzJokmdr6xAI9omapdeYdWFr1xrQytRcP/hLg+z+knendV3syfa9Th53j6h5+fVoZqqEyVZKUHBe7tY0qJyyEnMYrSACpq2Wv1MraU1ZyA2pvQo+7Qlo8D9lr1EsXq8r3iAXnv9gzsAZUxfPN7UkgyNrj1CpDkk6utnLrMiiFxiLqyTprhRdzparps4NqX2H4uQPo45WoAH2A4JiQQ0xfYzTw1v0t+lvyFfUgtjmefpQ== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040522)(2401047)(5005006)(8121501046)(10201501046)(3231254)(944501410)(52105095)(93006095)(93001095)(3002001)(149027)(150027)(6041310)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123564045)(20161123558120)(6072148)(201708071742011); SRVR:VI1PR0801MB1342; BCL:0; PCL:0; RULEID:; SRVR:VI1PR0801MB1342; X-Forefront-PRVS: 066898046A X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(6069001)(346002)(396003)(39850400004)(376002)(366004)(39380400002)(199004)(189003)(52116002)(23676004)(26005)(68736007)(186003)(2486003)(6116002)(97736004)(61506002)(86362001)(3846002)(105586002)(575784001)(106356001)(16526019)(55016002)(66066001)(11346002)(446003)(25786009)(486006)(7416002)(76176011)(8936002)(305945005)(956004)(478600001)(7696005)(5660300001)(230700001)(47776003)(386003)(316002)(59450400001)(39060400002)(476003)(2906002)(55236004)(7736002)(6506007)(6666003)(6636002)(58126008)(53936002)(81166006)(9686003)(8676002)(33896004)(81156014)(50466002)(103116003)(921003)(1121003); DIR:OUT; SFP:1102; SCL:1; SRVR:VI1PR0801MB1342; H:localhost.localdomain; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; Received-SPF: None (protection.outlook.com: virtuozzo.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtWSTFQUjA4MDFNQjEzNDI7MjM6WmI2eUUxZG0rUlZKbERpWUJQS0dsZll1?= =?utf-8?B?SmNnNG5jQWNVVTdXMTJqOWIvd2JUMDBhakt4WWF3ZEExVm54Sy8zVlpjZE1Q?= =?utf-8?B?ZVI0bHJhMGdlZVd3Y1lva2hVTEptZ01JSks1VWp3K0NXKy91OXRjTkU3UjJx?= =?utf-8?B?MzVERGhQVUtURjdZcVRGc2Z3U1VpYmtLQVV5MEk4dlY5NFU5SkQ2MmkwQUJI?= =?utf-8?B?UlhiN0JqcFVEZUwxZEluTVRVb1RybHNReHZmRWhpeDdUTDRQazVkV284cElM?= =?utf-8?B?RXVvS3Z6SEZzNVZYUUltYnRDMkFrSUFwM0RNRW9NZGVhYkJTZVk3UUthazBU?= =?utf-8?B?aDBPcGIrWkZyR1Z0cXFadUp1VTd5Tk5sQ3VJbDJHQTlOWlBwajJ1QjBsUXhw?= =?utf-8?B?d0tCem14NUt6MWl1SEtndHp1ZTM1di9mbXJzYzFmTEd1bExISlczejh1aWNH?= =?utf-8?B?ajJHa3haMXVHNnhaR3YxVDNwNEVxUjcrZ1hQMXJTSitBa2xJZWFLSjBlT2RF?= =?utf-8?B?ZDkremFha3grenprS0J1Wjlack1kQXp3Uk0yRHhQbVlmQjJaTkkwUGlGZ2lN?= =?utf-8?B?OFN5V1RIL1lrSzBudUEwNWc5MkhpbEZyU05hekVDNDJRaGJBc3h1aEF1V1Fw?= =?utf-8?B?cC8xN2JJSXBIaWErWU1XY2F4cGxqZTRmNXV1d25VMzhFRjVDS3NGRGtPTXY3?= =?utf-8?B?aHM1anJ6Um9uZll6SmI1MzdtNUZyYkZLWFNER3JiUUF4c2NwdkhBcnlOMFhp?= =?utf-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/ULEjp63I8kgKqEZai8KAdr1PYzUf70NfECr1T3KP03M54nKiOvKFPaljhaBBEPkHQRNrNDWJM7/8GLGThyGgIo=; 24:pn4uQ5HUnC1v2NRqyc/LR5Y9LlZ16DL2dlgKhXw/MXp1bVU5KgVWxoVb9FzV5KgV4qMhqh/BObsnXcR/VcKEQeqBVwQRPysz1psO9ZqSKqg= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; VI1PR0801MB1342; 7:IRHo0N0o/jO3dEzMpXRGJEnxhpWTvR8V69CpdRLXYt1mh5Ra1rmPDTfv9POTWQF5IrSx8SaC+DnTzB6lpQsUcqAY45RjDKdnKGS6HLSCyQzkbx1rZ+XM4pti3tJqMK60DYbF8PsDlHaEI20R69ddQ9AaaxV/8d8XmLvMgK/M67K8WO14CYVyjdFciu5NR0osQUJL2WeXw+EFnVZde+/nihNWDvjNiUrPjvIsJF7Px7JgCNZ0FyWTGiGcJnsgd2QR; 20:wxeZX9+woOjFYzJBBXLStJ6P2Kw0gMe5BrKoY+ueIkqNKpwY92cw9Q99Ys6utGAkLM529cYmDBertIVtNkoJxLPDeL6F9EaUzFki7UBedz80zR8AJ4qfj6k8aopum55okgUJZ+GFBlrpuKwLJptrstkEL6sncXKFBUieBKNWla4= X-MS-Office365-Filtering-Correlation-Id: e49ef276-4248-4167-b73d-08d5b65bee6d X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 May 2018 09:53:48.1239 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e49ef276-4248-4167-b73d-08d5b65bee6d X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0801MB1342 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: X-Virus-Scanned: ClamAV using ClamSMTP Introduce set_shrinker_bit() function to set shrinker-related bit in memcg shrinker bitmap, and set the bit after the first item is added and in case of reparenting destroyed memcg's items. This will allow next patch to make shrinkers be called only, in case of they have charged objects at the moment, and to improve shrink_slab() performance. Signed-off-by: Kirill Tkhai --- include/linux/memcontrol.h | 15 +++++++++++++++ mm/list_lru.c | 22 ++++++++++++++++++++-- 2 files changed, 35 insertions(+), 2 deletions(-) diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h index e5e7e0fc7158..82f892e77637 100644 --- a/include/linux/memcontrol.h +++ b/include/linux/memcontrol.h @@ -1274,6 +1274,21 @@ static inline void memcg_put_cache_ids(void) extern int memcg_shrinker_nr_max; extern int memcg_expand_shrinker_maps(int old_id, int id); + +static inline void memcg_set_shrinker_bit(struct mem_cgroup *memcg, int nid, int nr) +{ + if (nr >= 0 && memcg && memcg != root_mem_cgroup) { + struct memcg_shrinker_map *map; + + rcu_read_lock(); + map = MEMCG_SHRINKER_MAP(memcg, nid); + set_bit(nr, map->map); + rcu_read_unlock(); + } +} +#else +static inline void memcg_set_shrinker_bit(struct mem_cgroup *memcg, + int node, int id) { } #endif /* CONFIG_MEMCG_SHRINKER */ #endif /* _LINUX_MEMCONTROL_H */ diff --git a/mm/list_lru.c b/mm/list_lru.c index 7f6cb27aa2f5..6ce52f80f12c 100644 --- a/mm/list_lru.c +++ b/mm/list_lru.c @@ -30,6 +30,11 @@ static void list_lru_unregister(struct list_lru *lru) list_del(&lru->list); mutex_unlock(&list_lrus_mutex); } + +static int lru_shrinker_id(struct list_lru *lru) +{ + return lru->shrinker_id; +} #else static void list_lru_register(struct list_lru *lru) { @@ -38,6 +43,11 @@ static void list_lru_register(struct list_lru *lru) static void list_lru_unregister(struct list_lru *lru) { } + +static int lru_shrinker_id(struct list_lru *lru) +{ + return -1; +} #endif /* CONFIG_MEMCG && !CONFIG_SLOB */ #if defined(CONFIG_MEMCG) && !defined(CONFIG_SLOB) @@ -121,13 +131,17 @@ bool list_lru_add(struct list_lru *lru, struct list_head *item) { int nid = page_to_nid(virt_to_page(item)); struct list_lru_node *nlru = &lru->node[nid]; + struct mem_cgroup *memcg; struct list_lru_one *l; spin_lock(&nlru->lock); if (list_empty(item)) { - l = list_lru_from_kmem(nlru, item, NULL); + l = list_lru_from_kmem(nlru, item, &memcg); list_add_tail(item, &l->list); - l->nr_items++; + /* Set shrinker bit if the first element was added */ + if (!l->nr_items++) + memcg_set_shrinker_bit(memcg, nid, + lru_shrinker_id(lru)); nlru->nr_items++; spin_unlock(&nlru->lock); return true; @@ -522,6 +536,7 @@ static void memcg_drain_list_lru_node(struct list_lru *lru, int nid, struct list_lru_node *nlru = &lru->node[nid]; int dst_idx = dst_memcg->kmemcg_id; struct list_lru_one *src, *dst; + bool set; /* * Since list_lru_{add,del} may be called under an IRQ-safe lock, @@ -533,7 +548,10 @@ static void memcg_drain_list_lru_node(struct list_lru *lru, int nid, dst = list_lru_from_memcg_idx(nlru, dst_idx); list_splice_init(&src->list, &dst->list); + set = (!dst->nr_items && src->nr_items); dst->nr_items += src->nr_items; + if (set) + memcg_set_shrinker_bit(dst_memcg, nid, lru_shrinker_id(lru)); src->nr_items = 0; spin_unlock_irq(&nlru->lock);