From patchwork Wed May 9 11:58:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kirill Tkhai X-Patchwork-Id: 10389283 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 5D59C60236 for ; Wed, 9 May 2018 11:58:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4BC1028C59 for ; Wed, 9 May 2018 11:58:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3F02028EA3; Wed, 9 May 2018 11:58:40 +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 625D428C59 for ; Wed, 9 May 2018 11:58:39 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 39C546B0500; Wed, 9 May 2018 07:58:38 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 373BF6B0501; Wed, 9 May 2018 07:58:38 -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 213A66B0502; Wed, 9 May 2018 07:58:38 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pf0-f198.google.com (mail-pf0-f198.google.com [209.85.192.198]) by kanga.kvack.org (Postfix) with ESMTP id D16C76B0500 for ; Wed, 9 May 2018 07:58:37 -0400 (EDT) Received: by mail-pf0-f198.google.com with SMTP id e20so26139292pff.14 for ; Wed, 09 May 2018 04:58:37 -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=VPXNrYVvRsBOwJ6oLfLagyddZTcE+4Uvu/85pcJPVTU=; b=diMgAZ7DVMalEhE9BqtZVErviVWYXErzLHqYK9YLMILRy1MQJP+1iVprRdTfFbmfPz 9nlXXuZF3ZEP3yachNWerLUwnESxPoUp8F6bnucTfSaSkH3btx8sFSNRHMG5k8H6CW2Y Z36jY1eojv+GiZDJ89h2bxqy3rW2L9Dg1+T5b+cjzrvmADMuPgehdgBD1/0Yjy7u3WlT eCsNak93vFluQvvnan3P3SxcjDQuSxqJ1wzP2t7ID9fNIELt9GItz4KhufYIEU7uDIRP +Z5kHwlzhG7uQZaupgYS1cpiFMi9MdEmRTY1crdOmdhrhTNUy1eUrBLBaQi/LlZLjtqK gDfQ== X-Gm-Message-State: ALQs6tCMfXYRAufqEgRsANwZH17sN4ULuvZR7/DPeZhuXCGdnYwpqdqG UGaJLFJuLPj0dww3XCBSUviiMH6RNGtnOMmqTsae1GMJqiWifPXoXrl8wPOXFX1pD69/qjPLXwI f4ZVk9mpCHH7ETYJQwF9DGUIlQFrpEm8CHr2lGiq+Y/J4ZGBY8urX1nBgBw8o13tSvQ== X-Received: by 2002:a63:6b43:: with SMTP id g64-v6mr28332317pgc.337.1525867117523; Wed, 09 May 2018 04:58:37 -0700 (PDT) X-Google-Smtp-Source: AB8JxZr7LCGGDaF1PNfjZTw8EaI5oPct7h6QVir/VYzs6QOHLWyG9kUItMVfWdCN0/7FbpSuCtR4 X-Received: by 2002:a63:6b43:: with SMTP id g64-v6mr28332283pgc.337.1525867116768; Wed, 09 May 2018 04:58:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525867116; cv=none; d=google.com; s=arc-20160816; b=ezlze92tc/H6R5EJihlUu9Taa/z60qD480h11gqvR9m/qjQGEliQb3E+6b4nL9F03m V5eIUjxahk3F6veod7yV01fpTVGAu1UXLhgC9B7uhszkhVifCXOfYcz0uxGSlZ7MFAqU CG8MEyuno3PX1wVtepxEn0DcOOFIx1Z0JHXMjjeUaLOmZLotQtQ7g6wUQt9yMAx1uCUh yTUhm7HJzg6N+xHNBN5XjjWKOdareZ9j42hA9Nw/7ba7+fQkvQH/IYoTGCNx3Fg0ZF7P HSdvOp/fIcKvvYmPxKSdsGd0GSQfRfUEBJtlWLmC8Ympp8PEEMDCQn4aZ3DzfRHoBBjd +Xhw== 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=VPXNrYVvRsBOwJ6oLfLagyddZTcE+4Uvu/85pcJPVTU=; b=O+tacgmAz++hZWm+cvaYLkXKzDeXeuv0ppV2mmSSkPy6EChLf75ig1808X3tqn3arz aGekQraWkKX42542y+GQOboiYJ2C5X/r8xsWtAbOh7V0DRMndsAk7Dbm+BywIuWyVL1v haN0v92vRId+a9NeymLjkQJWpcUxiioOY8+wuWRVbw0crnFckGqkRwBX+nSPugwb/lF/ n9j7pv0/vwTokEfWLe4t65gTGz4w9rRdmxXw6e5xutfDhq85ONBOl2hdU0ZmBpWsa+8/ QO61DXQx7CifI3+wGcHr+Ea318naCyBaG3Oz/Rp49Dfo54d1O/0t9v0lbT7HHdwT1doh XYSg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=selector1 header.b=CYwS3MwX; spf=pass (google.com: domain of ktkhai@virtuozzo.com designates 104.47.0.122 as permitted sender) smtp.mailfrom=ktkhai@virtuozzo.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=virtuozzo.com Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-he1eur01on0122.outbound.protection.outlook.com. [104.47.0.122]) by mx.google.com with ESMTPS id m1-v6si21685009pgm.413.2018.05.09.04.58.36 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 09 May 2018 04:58:36 -0700 (PDT) Received-SPF: pass (google.com: domain of ktkhai@virtuozzo.com designates 104.47.0.122 as permitted sender) client-ip=104.47.0.122; Authentication-Results: mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=selector1 header.b=CYwS3MwX; spf=pass (google.com: domain of ktkhai@virtuozzo.com designates 104.47.0.122 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=VPXNrYVvRsBOwJ6oLfLagyddZTcE+4Uvu/85pcJPVTU=; b=CYwS3MwXNveyJJb+6zLreVUKS+OCY2B/nPNtecCIrEp/G+J/hSUTiqGoC+0Nb2n3rqrRGEU3gXczh1LoqG+UdnXsaiJsAd4Pm+RGEEoCqxOk4JF1IIxfBDA+qgEj1oEWsoi6BMQlQkfXFiDKIlmxVypP434poGCWZ6/o5LGyvq4= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=ktkhai@virtuozzo.com; Received: from localhost.localdomain (195.214.232.6) by AM5PR0801MB1330.eurprd08.prod.outlook.com (2603:10a6:203:1f::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.755.16; Wed, 9 May 2018 11:58:30 +0000 Subject: [PATCH v4 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: Wed, 09 May 2018 14:58:28 +0300 Message-ID: <152586710832.3048.5849744392387674244.stgit@localhost.localdomain> In-Reply-To: <152586686544.3048.15776787801312398314.stgit@localhost.localdomain> References: <152586686544.3048.15776787801312398314.stgit@localhost.localdomain> User-Agent: StGit/0.18 MIME-Version: 1.0 X-Originating-IP: [195.214.232.6] X-ClientProxiedBy: HE1PR1001CA0014.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:3:f7::24) To AM5PR0801MB1330.eurprd08.prod.outlook.com (2603:10a6:203:1f::8) 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:AM5PR0801MB1330; X-Microsoft-Exchange-Diagnostics: 1; AM5PR0801MB1330; 3:Dd9091RkwspXoA6yZmCg62xVrz7WO7oip03c+BDMJX2f1a/mfhv453NuEVL593401iXT6WSYOwmgO3lGJOVuVs6t7kGU5Z7YGyRwjuOsaqrFgO3aWKj0FKgtVssTwlE9F/L5YLLnEUNeLDMo2ezAp7Z+t+2rs3STsIXDj06itvf/DW46tsnCTxa2/G3172f1JGL+VkiMwIRdtz0El5uZIlrgNe4QbCH3x+/wkzpOPSKj8UE7s/o6gXlX6GN+6HXk; 25:V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RSH8M+e48VhWgDTlr/YThkNxxwqwAfIxqezVoZxtmEEPoiph/KFY0+tArzGAirfbo9DJVV2WREoV8G6e; 4:ryNoqopviYOeBuKpAF4vnXbF6yjFvC0Xwf8I8tHHVPb2CQWysFNw2MXwgFLdZwV+LojNAgzwM3pxIsF5OKQ6MAHwZa1lKTEzJFNUwVoVKrPJ39KJ03qdzZsCOBMwwlEJBc5lEwSiJP3vAAC2iNx4NKm5FoPOGKGaST1e4sGm7rllx2OKIHZaXJnaJhBBwnhGxByQTgAlVLNRiemn5Nx2yx6AUYhTV5g9toqe4X6rX9mzEIIocMnS6sZgjhCrBJEIL2whJOwKu52ZJ3H1e/JKrw== 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:AM5PR0801MB1330; BCL:0; PCL:0; RULEID:; SRVR:AM5PR0801MB1330; X-Forefront-PRVS: 0667289FF8 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(6069001)(39380400002)(376002)(346002)(396003)(39850400004)(366004)(199004)(189003)(2906002)(186003)(230700001)(575784001)(305945005)(103116003)(86362001)(6636002)(7736002)(478600001)(11346002)(16526019)(58126008)(53936002)(476003)(6506007)(106356001)(39060400002)(956004)(105586002)(68736007)(5660300001)(7416002)(2486003)(446003)(25786009)(486006)(61506002)(316002)(97736004)(55016002)(23676004)(52116002)(7696005)(81156014)(81166006)(47776003)(8676002)(59450400001)(8936002)(50466002)(33896004)(26005)(386003)(9686003)(55236004)(6116002)(76176011)(66066001)(3846002)(921003)(1121003); DIR:OUT; SFP:1102; SCL:1; SRVR:AM5PR0801MB1330; 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?MTtBTTVQUjA4MDFNQjEzMzA7MjM6RkhVRVRLcDU0Q3krRUIwUVNib3lSMHJw?= =?utf-8?B?UnlFeWliMVJiT1JCb0psazdPQkcySTlGclFJUEI1MkRyZEgzM0J1UzBReFpz?= =?utf-8?B?c1Z0RDhYYzNZcWswQTVZT2E0ZEE0UDVIVEhGdlVEZWo3SUYzV1I1Vlh3UHJI?= =?utf-8?B?dklUQkdjUlhFRVNqdXdEaEdDOFJnbCtXQ0xiaE1ZRmlzL1phdkE0cHJyV2ly?= =?utf-8?B?TkF4eXBpeU1DV3psVWlLOTIzR280K0I2KzJQK0FOUFBsb0lubEhqWjhnWk1t?= =?utf-8?B?RG5yRlBKYzVZeWJlbzliZjNOYWc3NW9TR0pTcjJCT2UxeWljWmlpZ0ZLRW45?= =?utf-8?B?NVU3SXRoYnpzL09ESU9mcUZuWjliREQ2ejVzTmsvd09aRU81QmhZRThndTdj?= =?utf-8?B?eS9Yd0pNOEkzZzgxWHRiV2FFUndLZzNqY1k3S0c3TFhzNVlLOHdjSkJKL1Nl?= =?utf-8?B?OVVnMnI0UFNQcVhOc1ZaNWVOdkh5cVdoWWRHNTUxRll4aXlvOGpvN0NDU2d3?= =?utf-8?B?VmE1TExxWStWTGRUYkFjWFZTaFd4K01PTWpCMXI3c1dNQkpRYjQ4NTFldEYx?= =?utf-8?B?REdwQ1ZqRWdUVEUvTVZBTTRnTWFDZ1loc3gvUzE4MTFNcThEMEJySVgxRTNt?= =?utf-8?B?cGh2TnFJcnFHTy8zcHUyOHNDQlNUdDFxZWFzbUkyM1ZnRllFNlhZYXJHUTJq?= =?utf-8?B?R004ajFiVXFEamg2MkwxVFMwemtidnp4MnN5UmpVR2FxSXRySXVJS2RHbkRE?= =?utf-8?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ar2cGzMZHRIvPjWLRqnXwYtbnZAYevALrbk6sf8YU7MAQpucSQE=; 24:an5+AVHHI6Z+AUTCIWBOXzRr7uMDvLPKSAMUqM11Ve3qOgS6kZBFP/qPzj8XM+UH+GYfeW0/qT9h2Yn7KufZa5WNTzA0zqR++YVwoALlFwY= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; AM5PR0801MB1330; 7:m5/N1947PIhCHWEM4BqjIwBBZtj7OkIiTIsa1bJfi0UzR+olqrLi1gwHu310n7c2OV1PTMr7XLiLHy2AKXbJbntkJcdWoDQy9bpbTStjPVdpOcLKOUqLdYHedN+iqj/jt3c7rh5yo4dmKJGSZ4CsY/57/MrFPpfu0PFZwVRXALsToebdo8ATkN3uFUd1OXiKhoTvlUVZO6CZalRO1cCAQoxqd5h09k4sAc6MqlHBozfRkL8XurT3TkbmV8Kjwi7c; 20:/WxsQxJUBOBwb8hi6EJdwFCEZsgu35MXzORzPM2r772+3EOkqq9gtDAF35ghnOQ1sRHlW+egOr78Bu2cL0rAIO34W9gTxFgtdPnNpUmr72f4qtkFWqGHKCZ8d2X0JH7iQonm66emfq++pp6Cvy2oqrPFJR8mRSODRI2vh8GR0JI= X-MS-Office365-Filtering-Correlation-Id: 0b1fe75a-1136-4081-42cd-08d5b5a42ff8 X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 May 2018 11:58:30.9672 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0b1fe75a-1136-4081-42cd-08d5b5a42ff8 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM5PR0801MB1330 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 | 13 +++++++++++++ mm/list_lru.c | 22 ++++++++++++++++++++-- 2 files changed, 33 insertions(+), 2 deletions(-) diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h index c159f3abe168..1fb2f96dc2f6 100644 --- a/include/linux/memcontrol.h +++ b/include/linux/memcontrol.h @@ -1247,6 +1247,17 @@ static inline int memcg_cache_id(struct mem_cgroup *memcg) 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 #define for_each_memcg_cache_index(_idx) \ for (; NULL; ) @@ -1269,6 +1280,8 @@ static inline void memcg_put_cache_ids(void) { } +static inline void memcg_set_shrinker_bit(struct mem_cgroup *memcg, + int node, int id) { } #endif /* CONFIG_MEMCG && !CONFIG_SLOB */ #endif /* _LINUX_MEMCONTROL_H */ diff --git a/mm/list_lru.c b/mm/list_lru.c index ed0f97b0c087..478567332746 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);