From patchwork Mon Jun 18 09:47:01 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kirill Tkhai X-Patchwork-Id: 10470563 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 D95FE6029B for ; Mon, 18 Jun 2018 09:47:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C717E2853C for ; Mon, 18 Jun 2018 09:47:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BBB93289A3; Mon, 18 Jun 2018 09:47:12 +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 13B842899F for ; Mon, 18 Jun 2018 09:47:12 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0CC4D6B0266; Mon, 18 Jun 2018 05:47:11 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 0A2176B0269; Mon, 18 Jun 2018 05:47:11 -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 E5FEA6B0275; Mon, 18 Jun 2018 05:47:10 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pl0-f71.google.com (mail-pl0-f71.google.com [209.85.160.71]) by kanga.kvack.org (Postfix) with ESMTP id 9F7EF6B0266 for ; Mon, 18 Jun 2018 05:47:10 -0400 (EDT) Received: by mail-pl0-f71.google.com with SMTP id e1-v6so9802689pld.23 for ; Mon, 18 Jun 2018 02:47:10 -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=IgshiDlar6LEDDTF7ZTJ0rDHZzl9+2WJMnaH8hVXVbM=; b=GxQ2up4cHNeCH4B9HlIk9hLyrD7Ilk4NyURagA6uZ64RLLXXE8ccxkcO34Bboi9gKI Hq3pzp+Sc2DCRLUv50IbkPictoAxuHPAzJni+jrVALv/hb7AT8W6MdrLTcusVzp4MXTu qvc60B9NbcTPZH7pTPPsJUzKyfVcg/TAi1YGULRIlwMlo0vTu/EN+FVJpycP5TBK4Ua8 OkTvHqxhNFaYFHjgsdbmwj13OGTq1wJ3YUM1mp/0XzrISI0Mwp9pkgby0bNxID58NfnW oqTWPxkg9oSK6b2HubSe5GvvDucvFPytm9dyMAcrMxsf8LA3ADX7Ql3mmRe/Rb/9oFJH BHqA== X-Gm-Message-State: APt69E3WXIVFmDE+wSHocsDkauM3xcCiNlimCMobd22rK+ucr/dhaguO BP2LXuQ98mvuyVGmLuE/Fdp9op4ZM9Cv9B6Y9eYSuHkF3g59GsdSyfyqfzVazq7V7i0To1h3BJG 125S1X+b0Izne2A+jL+o6SEfwYAXZJvosGxqnoeTT/1lGKRfSz5wyshoW8sJRQNSAdA== X-Received: by 2002:a17:902:aa87:: with SMTP id d7-v6mr7740719plr.215.1529315230242; Mon, 18 Jun 2018 02:47:10 -0700 (PDT) X-Google-Smtp-Source: ADUXVKK/JD7MVj8hVQDL/r3MWw8YulZujG4GXnYlpGIwmzTWl/BB2Tb2kHjB+DXw9HmA5oOSNdk7 X-Received: by 2002:a17:902:aa87:: with SMTP id d7-v6mr7740664plr.215.1529315229407; Mon, 18 Jun 2018 02:47:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529315229; cv=none; d=google.com; s=arc-20160816; b=pusG/l8V5Hxld1BMJpG7FJEEYT6CKb2MASsPHWiO8T4eb3GAKthRE+t7RsCqHZkKOu OazkCClklrZcspWQu7JkXF30etqmIAHfiK7EOQeiA5Og5qFY6nM2OjK3f68nJmOEQYIV gHOERkTsYNwuxDDJ9q5MGhpUBU/sE6Hqgc8afPy8O5VUwRqv+xpCAUvMJ2aiZQGIm4Kq N4bK6erdG7LEb9xpiRaX9dqdgRbjeQ5jMx3qoBOPD0gJQ2ntRge7//Aa6cM2x65ptm2z jqDhRQlBZ9VibaxL8bD69H5Dv1G+v9Q/ZHrXRCgToh/NaTnAf4aeTvAqMfVxhqoaVk8A g9aA== 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=IgshiDlar6LEDDTF7ZTJ0rDHZzl9+2WJMnaH8hVXVbM=; b=XxYJoZjd2Xh1AWcJACf4TokmA44R/9OiIYLBKdJ/wNb0lxBcbVN7bZE15Pr78LexYu NRqLD7LNbyjMS6PIeafGdFcpYx0190N2g7RKLVUMXRG2r4W0iOwCF9KivU6gPlIbaTc7 rynpb1Wv3vFCLzkG9S5GOvwTm9M5BXVkHC479n+SrKBVF5qJd46g0m15L4emgU80x2aL ycSZtjCgRkSUyvd7ZCJHZkBfWbKVD6ARb/VrNUTK6BmGWshkGXtCpme8GmWKH5zFE7ag Po6psK7m4SdJKSd6WXukYQHX67qO8EBBEumaImvKJsMYSupB174/QNYUrf7Vfati/nai Hhrg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=selector1 header.b=TkvwxTzS; spf=pass (google.com: domain of ktkhai@virtuozzo.com designates 104.47.1.119 as permitted sender) smtp.mailfrom=ktkhai@virtuozzo.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=virtuozzo.com Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01on0119.outbound.protection.outlook.com. [104.47.1.119]) by mx.google.com with ESMTPS id w5-v6si11683811pgq.110.2018.06.18.02.47.08 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 18 Jun 2018 02:47:09 -0700 (PDT) Received-SPF: pass (google.com: domain of ktkhai@virtuozzo.com designates 104.47.1.119 as permitted sender) client-ip=104.47.1.119; Authentication-Results: mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=selector1 header.b=TkvwxTzS; spf=pass (google.com: domain of ktkhai@virtuozzo.com designates 104.47.1.119 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:X-MS-Exchange-SenderADCheck; bh=IgshiDlar6LEDDTF7ZTJ0rDHZzl9+2WJMnaH8hVXVbM=; b=TkvwxTzSDCjDJ67rR9IylxTNKCBn7fzKcQ3c7MR0qJvDOaHHmt480Zy3OFHiYvspN58jQTkBsAvYn3Gz0Ujk2x1vdIoFzKa1YFBDTG97/cjRrL5R19wI+yWKe1lra1GfBOvnwO5iIxT4Zj0P6dqV2tNA2FpK9Y1MFQBngFMlvnc= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=ktkhai@virtuozzo.com; Received: from localhost.localdomain (195.214.232.6) by AM5PR0801MB1331.eurprd08.prod.outlook.com (2603:10a6:203:1f::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.863.19; Mon, 18 Jun 2018 09:47:03 +0000 Subject: [PATCH v7 REBASED 13/17] mm: Set bit in memcg shrinker bitmap on first list_lru item apearance From: Kirill Tkhai To: vdavydov.dev@gmail.com, shakeelb@google.com, viro@zeniv.linux.org.uk, hannes@cmpxchg.org, mhocko@kernel.org, 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: Mon, 18 Jun 2018 12:47:01 +0300 Message-ID: <152931522144.28457.11688383753444980791.stgit@localhost.localdomain> In-Reply-To: <152931506756.28457.5620076974981468927.stgit@localhost.localdomain> References: <152931506756.28457.5620076974981468927.stgit@localhost.localdomain> User-Agent: StGit/0.18 MIME-Version: 1.0 X-Originating-IP: [195.214.232.6] X-ClientProxiedBy: HE1PR05CA0249.eurprd05.prod.outlook.com (2603:10a6:3:fb::25) To AM5PR0801MB1331.eurprd08.prod.outlook.com (2603:10a6:203:1f::9) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1390b07f-c182-4e82-a47a-08d5d5007309 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(4534165)(7168020)(4627221)(201703031133081)(201702281549075)(5600026)(711020)(2017052603328)(7153060)(7193020); SRVR:AM5PR0801MB1331; X-Microsoft-Exchange-Diagnostics: 1; AM5PR0801MB1331; 3:wjwYYhMeTD0/paqPXjEulocdl8giQsRlKsJveka7jh9Q/lAl6iJPBOqo/5UyAiK0HNth3XBvN5KJOZUGmR+pUyigXSVDOF3goFxHu1SkcKCoUawwTSfoeeYmT1zgJy2kGB9o+oTZc1U0WcSkMOaEFOoTn2TwsqFpeS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EsYAGbkh63mYyhlqOIoP9qWn1LILOsECi1uG+P2dKUe+Ee86gFOhqbxy5rgAS4HuTAtSkstOFHmzRRJR/sStpVFAkImEoAlAgFVfN+1gWd1c3AtZtfUuMrVjUVeioQb7cqGwmHoTWWQGnK9Dw9XsARz3Pnt0Z8rVsFw355qLsNSnSBPa7me; 4:dnBDSR1CTL54y6uDaeVgqoZdYOr4Qx/rT4eXROUQMhvI5VTxmO+DkpkBm2vKOrrZzaXTsPOUrseueDJsTYNFGr/njpYfb/Gx13ETyMgQS76ppvM/bAyFDYzVWuqkzurRE8yprif6lLtChOT17Z2KJqnPKv5EeqOxwZ0ZafnMR3eHDT1lXscpE1bHVS7pVvqScKdKwLuxUpoLEoeEd464JgMN6e2RDiaHwIdZw2m7JxwbjBBiDLiSdt1ZsTwwCoKUZbJ4q0TLi6fh0/aArkGaDFVfxw/oZvzTYNztaH34OCZT/WvzZXsD9D4DgGknyyZRgKmqrJ8OP+zWzc/LwTV9w2SVjo/7TtryRP3+oH/SB4uanii/n/tePJsYxj3HSCtO X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(85827821059158)(211936372134217)(153496737603132); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040522)(2401047)(8121501046)(5005006)(10201501046)(3002001)(93006095)(93001095)(3231254)(944501410)(52105095)(149027)(150027)(6041310)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123562045)(20161123558120)(6072148)(201708071742011)(7699016); SRVR:AM5PR0801MB1331; BCL:0; PCL:0; RULEID:; SRVR:AM5PR0801MB1331; X-Forefront-PRVS: 0707248B64 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(979002)(6069001)(346002)(396003)(39380400002)(376002)(366004)(39840400004)(189003)(199004)(16526019)(3846002)(6506007)(6116002)(386003)(53936002)(11346002)(186003)(55236004)(230700001)(486006)(956004)(476003)(39060400002)(81166006)(446003)(25786009)(9686003)(26005)(478600001)(106356001)(8936002)(81156014)(8676002)(2906002)(103116003)(59450400001)(33896004)(97736004)(305945005)(7736002)(76176011)(6636002)(68736007)(2486003)(23676004)(52116002)(47776003)(7416002)(7696005)(66066001)(5660300001)(55016002)(50466002)(58126008)(61506002)(316002)(86362001)(105586002)(921003)(1121003)(969003)(989001)(999001)(1009001)(1019001); DIR:OUT; SFP:1102; SCL:1; SRVR:AM5PR0801MB1331; H:localhost.localdomain; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; Received-SPF: None (protection.outlook.com: virtuozzo.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtBTTVQUjA4MDFNQjEzMzE7MjM6eVRBcVBiM2x5ZVlnc3R4NStVSjNEK2xF?= =?utf-8?B?ZTJEWHBjVFNzZGZkMGJ2aHdyamJPNmNwVG1QaS9GcWJXUFY5VkJDR2dqYW44?= =?utf-8?B?bWpRSjBlV2llb1p5SUorYXV6U2pWc0Y2cFd1UktENzd2dTFxVFpnYkZ0ellT?= =?utf-8?B?Ny9BNkM2Qm41aUo3YS96Rnk5VWtnSGVGYnpLZndCOGt2QWp6Wm1SQm4raDJC?= =?utf-8?B?cllLb3dXRVdTb1dZTFcrcUdTOTRwWEE2YlJxSEE3eXJFV25qbVlDM2FaVCtK?= =?utf-8?B?ZmFPSXZleXgvRkhRVUxheWIvenVrZDF1d3k4OVgwNGJCL0xneDQydGwzbjQr?= =?utf-8?B?QkFIcFZ4WkNxOGVUdExIa0xvRDdVZnZUWlNsemJnNFhHQU1XOHRIbElYalQ2?= =?utf-8?B?UHlaMFlKUHdaeSt4ZzFJb1hISGl1MFFNKzh1MENBZ3pabS9JclVHNjkvdEty?= =?utf-8?B?YmVzbnUxdXNqT0d6NVlOOGlTK0dCU1RxYkw3dHR2Sm1hK1FsaFprV3Fpd1F6?= =?utf-8?B?RDBkOXpYOW1hU3JtMFVzeGhRZkJPOWtq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MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Jun 2018 09:47:03.3988 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1390b07f-c182-4e82-a47a-08d5d5007309 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM5PR0801MB1331 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 Acked-by: Vladimir Davydov Tested-by: Shakeel Butt --- include/linux/memcontrol.h | 14 ++++++++++++++ mm/list_lru.c | 22 ++++++++++++++++++++-- 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h index 7ef004c4f4af..f2292ea7892d 100644 --- a/include/linux/memcontrol.h +++ b/include/linux/memcontrol.h @@ -1249,6 +1249,18 @@ static inline int memcg_cache_id(struct mem_cgroup *memcg) extern int memcg_expand_shrinker_maps(int new_id); +static inline void memcg_set_shrinker_bit(struct mem_cgroup *memcg, + int nid, int shrinker_id) +{ + if (shrinker_id >= 0 && memcg && !mem_cgroup_is_root(memcg)) { + struct memcg_shrinker_map *map; + + rcu_read_lock(); + map = rcu_dereference(memcg->nodeinfo[nid]->shrinker_map); + set_bit(shrinker_id, map->map); + rcu_read_unlock(); + } +} #else #define for_each_memcg_cache_index(_idx) \ for (; NULL; ) @@ -1271,6 +1283,8 @@ static inline void memcg_put_cache_ids(void) { } +static inline void memcg_set_shrinker_bit(struct mem_cgroup *memcg, + int nid, int shrinker_id) { } #endif /* CONFIG_MEMCG_KMEM */ #endif /* _LINUX_MEMCONTROL_H */ diff --git a/mm/list_lru.c b/mm/list_lru.c index 79a22404464d..976d634a479c 100644 --- a/mm/list_lru.c +++ b/mm/list_lru.c @@ -30,6 +30,11 @@ static void list_lru_unregister(struct list_lru *lru) mutex_unlock(&list_lrus_mutex); } +static int lru_shrinker_id(struct list_lru *lru) +{ + return lru->shrinker_id; +} + static inline bool list_lru_memcg_aware(struct list_lru *lru) { /* @@ -93,6 +98,11 @@ static void list_lru_unregister(struct list_lru *lru) { } +static int lru_shrinker_id(struct list_lru *lru) +{ + return -1; +} + static inline bool list_lru_memcg_aware(struct list_lru *lru) { return false; @@ -118,13 +128,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; @@ -513,6 +527,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, @@ -524,7 +539,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);