From patchwork Fri May 18 08:43:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kirill Tkhai X-Patchwork-Id: 10408789 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 70023602CB for ; Fri, 18 May 2018 08:43:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5F55228462 for ; Fri, 18 May 2018 08:43:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 52F78288B9; Fri, 18 May 2018 08:43:56 +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 8350128462 for ; Fri, 18 May 2018 08:43:55 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4817C6B05B6; Fri, 18 May 2018 04:43:54 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 459746B05B7; Fri, 18 May 2018 04:43:54 -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 321236B05B8; Fri, 18 May 2018 04:43:54 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-qt0-f198.google.com (mail-qt0-f198.google.com [209.85.216.198]) by kanga.kvack.org (Postfix) with ESMTP id 060566B05B6 for ; Fri, 18 May 2018 04:43:54 -0400 (EDT) Received: by mail-qt0-f198.google.com with SMTP id w26-v6so6182574qto.4 for ; Fri, 18 May 2018 01:43:54 -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=HMwdRD3+7OdPBg0FuiXPYL/OV9rHb3ut7yPZXNSPW2s=; b=OPIpTXQwJoharYABr/X/PqqDdFiznCsqGKvAmZUhsOWzfhlXUJ3DkXUF0yHDVwH8x9 ZMxF1Pir2rrQK79byxzeYXp5Do894zc141vd8M/7Wqdw+vLyhELPaE9Tz3SXQ7wec8mZ dxwtaSZAtMXhuCz1R1pzLzjKPBZEQ0kMqoMqZwIP90XxtpYSNlR+lVHv75piYM5jgnGi F3BmHQsERjAyeO/hZMSkWdHoGVk5g+BaHYz3Y0hNGKnXRwKTy/KMXY7kD4paFAkRyD/W W/kQEcnqcHel71PI5nR4lZcpUTcUOWfGVTwZDkeY9ppZL4UbZB/C7aeWKT9A36FtwFDh /wTQ== X-Gm-Message-State: ALKqPwcEEmgxcrYf0QfKOVsubp0+KEPZYV5xwCkch/AEX5b+aIzAgU1g /7yi8JF56mN90n7mdoebCoOuYr+WS8UmKAl+/JGuO2CB3OVX3jxhNkov3P/q3QCFwrnWY/F/GXA gEnp/zEQGUXv62CIjFsBvofg5eqhNiPMiwEN7lYEmUsg5jhQhWhtn7RyuRUF8VxpvTQ== X-Received: by 2002:a37:d494:: with SMTP id s20-v6mr7923034qks.338.1526633033801; Fri, 18 May 2018 01:43:53 -0700 (PDT) X-Google-Smtp-Source: AB8JxZog0QyS+iEtatsr2GAsLZy/J+h1IKK4bjtip2FSGh8DMv5VNtLLMklws8xWXSeIp9NFCnWp X-Received: by 2002:a37:d494:: with SMTP id s20-v6mr7923014qks.338.1526633033101; Fri, 18 May 2018 01:43:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526633033; cv=none; d=google.com; s=arc-20160816; b=IMhYjPLlUP4LegN+IEtgPDmcV+Ccg1p8zc3q8F6AyiIPgfeLUPK1F9nGL9IOjdvr6O UbR6LkuK3p3C1d3dYile0wjGqobC2mbfI2TEC713HJ+ZzxkEx3N2HOR/hF/DbdMCAKJi a+0ffE9g/Rhn4qvyj+stvmacwRF6zqUNYwmI9wchnvEraHVGZ6doHC/NfZcmdfy436z0 HDh1DSMrOczknYu1+uw8wUDhA9Sg7+J8AjjiVR/c1EoY8skSZ5LEKsk2qfy9Rj2xONzt aidYalAJvkQATruCt0DWYr4HGIaR58iQyaBuyyreqDz+Tz5H+RweQb2nEwe7Yb39YMc1 nSEg== 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=HMwdRD3+7OdPBg0FuiXPYL/OV9rHb3ut7yPZXNSPW2s=; b=e7L/O999VtMPx8Clrd4oNIusubTU1Y7iTNiVmqJgF/hVjRQ7yvRRRS2i8jw1u/xYvS ta4wT+w280ZIVLDE9Smxk3siBIlwBgrHGegqQtUaF46nza4CxLkkuEDopfYiOmU2s/G2 /5fhYbhEMCBoQqeBvXU/uhgsHWaixlO3RvxYVDrBmly/PHruB+5d1nZCPKR/RxZsph4K 5FaADl8kPshJn2L1R3n/Mcdiy5XrsrRfzyHQQgP6ffbIDDGy0E/4/z8v2Hj6re2cgrZg hFKWQ5VrF+0nAgSTwE9YITkbpLprFdrD8ggKUHDnz5TA3iUEq04oIKKvABcKSusCmydJ 0bMw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=selector1 header.b=UpPy2lsY; spf=pass (google.com: domain of ktkhai@virtuozzo.com designates 104.47.1.136 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-ve1eur01on0136.outbound.protection.outlook.com. [104.47.1.136]) by mx.google.com with ESMTPS id d66-v6si6030781qkb.390.2018.05.18.01.43.52 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 18 May 2018 01:43:53 -0700 (PDT) Received-SPF: pass (google.com: domain of ktkhai@virtuozzo.com designates 104.47.1.136 as permitted sender) client-ip=104.47.1.136; Authentication-Results: mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=selector1 header.b=UpPy2lsY; spf=pass (google.com: domain of ktkhai@virtuozzo.com designates 104.47.1.136 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=HMwdRD3+7OdPBg0FuiXPYL/OV9rHb3ut7yPZXNSPW2s=; b=UpPy2lsYeJAWddQDRMtwRnDWqzl/W1swvUJfXZspfC72YAKFwA5BpBdg46XWMyalATUR+9Vkq/h3lma5A7xnsvKT+t6nuexbWBOG7YBfyMY3uUpxQ3hOFLJbT37SEL8paSkA2PPzEhw8+4J49veo8BUhYU7TAFd8BECi0LKAZtU= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=ktkhai@virtuozzo.com; Received: from localhost.localdomain (195.214.232.6) by VI1PR0801MB1341.eurprd08.prod.outlook.com (2603:10a6:800:3a::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.776.11; Fri, 18 May 2018 08:43:45 +0000 Subject: [PATCH v6 12/17] 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: Fri, 18 May 2018 11:43:42 +0300 Message-ID: <152663302275.5308.7476660277265020067.stgit@localhost.localdomain> In-Reply-To: <152663268383.5308.8660992135988724014.stgit@localhost.localdomain> References: <152663268383.5308.8660992135988724014.stgit@localhost.localdomain> User-Agent: StGit/0.18 MIME-Version: 1.0 X-Originating-IP: [195.214.232.6] X-ClientProxiedBy: HE1PR0902CA0016.eurprd09.prod.outlook.com (2603:10a6:3:e5::26) To VI1PR0801MB1341.eurprd08.prod.outlook.com (2603:10a6:800:3a::27) X-MS-PublicTrafficType: Email X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4534165)(7168020)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:VI1PR0801MB1341; X-Microsoft-Exchange-Diagnostics: 1; VI1PR0801MB1341; 3:5cG6Cn6gfAi1xXL8PE3pa9s6Tkuv5GGOjsyUSYURydGUqUpeo9kHZd1ZMwtDdbU8PhTVt0AySKyJWq3u9lfoqfhHGXdPGgYEDl89WlJDMOdh2pvLlrUjDI1QnKvmbqqTzenYXEF4mYVHts8MpNSn7O+H9NL13QMvr+sBti8Trr0PfCSzLdi/cweIjfLi7HBV13xgMMm2kbsI73eVcV8OljnBM8HxxtpzpTMRjoMqbuf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4V2iYbwoQj4Fc5et+KOiU1iNSDjYCBfUtLDMoBXCt3WMH/ejG/SKGiULP6d5RnZR0O4NDDRniKnxQrw7q9lESzUsAe8GcCHYYvv8; 4:1R952GqsdgL0HKZt2UV4dGPATUGkQRaK1zn0sQVKZiK6cfd//+0f2OWbf3lu4Xl0xRcpPY7bShgtOovjR2c2hRahHQ6GDGNK6BXu8q3Q0KTlUcHGCetO0PsUQi9BDZqnUT9Sx7IvMnHlID8uVlU899HRoIrRqKkvlyAeqpX56rsH9KPU8tWBrDHppmX55BL7PkEZDKvA8CzujPGP64CtmiSqc3CwfeanB/zHWukuA7E4Y9gZ670+RNEQ5E3PWg4VWijot2MN1FqhdEC6a4xROQ== 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)(8121501046)(5005006)(3231254)(944501410)(52105095)(3002001)(93006095)(93001095)(10201501046)(149027)(150027)(6041310)(20161123558120)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123562045)(6072148)(201708071742011)(7699016); SRVR:VI1PR0801MB1341; BCL:0; PCL:0; RULEID:; SRVR:VI1PR0801MB1341; X-Forefront-PRVS: 0676F530A9 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(6069001)(376002)(39850400004)(39380400002)(396003)(366004)(346002)(189003)(199004)(6116002)(25786009)(39060400002)(81166006)(81156014)(106356001)(8676002)(68736007)(486006)(55016002)(8936002)(66066001)(47776003)(11346002)(3846002)(446003)(476003)(478600001)(956004)(105586002)(16526019)(103116003)(186003)(59450400001)(58126008)(9686003)(26005)(50466002)(53936002)(2906002)(230700001)(7736002)(5660300001)(33896004)(316002)(7416002)(97736004)(55236004)(6666003)(6636002)(61506002)(86362001)(7696005)(575784001)(386003)(6506007)(2486003)(23676004)(76176011)(52116002)(305945005)(921003)(1121003); DIR:OUT; SFP:1102; SCL:1; SRVR:VI1PR0801MB1341; 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?MTtWSTFQUjA4MDFNQjEzNDE7MjM6bEFnVldjL0JhRnorNnBndnAyblF5Z2Rq?= =?utf-8?B?QXB1eEYrWWY3MEwxdTh4bE4wQ1NUa3NyMnd5VVdZMTJ6S1hIVStob0ozalhR?= =?utf-8?B?b0JrYkpwWjc1aWhNQ2ExMWpvR0RTUndtVFZOdWt1UkJpQnFYODZ5aDNtbHJZ?= =?utf-8?B?YmQ3L2FzekxCTXE5Q2NIYXAyRzg3SnpLS09GQWFkZlNnZlN4NXhQckd5cXNx?= =?utf-8?B?RFZELzlZWXYva1VNbUpBOFFCNTVFZ1RXSmRkMVpjVEpZdlJIUGcwV2RSWG5m?= =?utf-8?B?R0cxZm1xRVE1Vkg5QWRVek5ScnJnK3pkV01GV0h3NXdDa25LNmJkT0N0VitW?= =?utf-8?B?Wk1GYTZZSUpLSm9BLytLNFEydDlpakRmYjRmbldNT1hSU2luc3FZZmlRWUFU?= =?utf-8?B?UXo5WGVjNEc5WFIvMmdmUWNxR0dBL3ZBUWxXK3UwTi9JSUNpSmxhYm1waG4w?= =?utf-8?B?Mmt6RDZPSUxOLzFkUkpkZG5ZdGc0WmJrbXJMSnlzY0hNWTlWZ1phd2ViS21m?= =?utf-8?B?YmJsR1o5aUM3UzY5L3paalVyWGdmMnMzNHNZNmdXbWxpQzUyMGpFR0dxUFJP?= =?utf-8?B?d1RLMlQ1R2N2dTVMQkZITjREb1phOUNLRXh0TkZTanBKQ3NDYy9UWDlQT0FB?= =?utf-8?B?bDIrNUxrcUh5dzBibzQvWUM5cjduVUZ4UEdhYTMwR29VK2tXNnBicFArbVp2?= =?utf-8?B?VCtYQ09hZlJNYnBZOW8rcDdxUEdtMTdqbjhi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sABwzCpF1c86W3dLjLsK0+Z8LDCqT4WSZTgjFMAHtJYghWFBWEt47Ns3irhNKk69ljeOD9rS2z4atgyEiujbf0oq5ne4Gb2x3u+eZDXkz0Tj8liixFwwOtmhhzQgalKuNEU=; 24:MwBe9MN3RPjRlJ+/P3bfsdcQseuGAxDt7WWWE47wEfzO4l/BilwBCKLVuGym0xZnRJM+2pBO3i6qyozbXgcwfbvL3PRmwog982ltg01HXzw= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; VI1PR0801MB1341; 7:W9lgfCXCV5wIq+lOGMPzNk/iyPy4YEmhkpAVmP4As93xJCPH2NNwSpzagKybDVcjqyZDMfXcVqEOPstUQskJ9lvCIQpN2rX6AvrXP5CBbbVqSF8z9DJkq4QqM+uPN/uOLI1CD5+yqRxpKYPmS4ty99gXuDpTFj1AKEyykfBMmzMPKvFRYdUZ9LAZuaMRt5oQ+esei7uUl+NEAlbexMq+wEeAU1dGbYDUb7AEb7SgfhMtX0DN80hfOBGdK67QXe1Q; 20:XaJQ8TUgWcpUJBABttXQb3DpC1pqkdAaUncgFvZNRA6kyWZ0o2sWzVFxOohZpPi0hFGxKOmGjv6/1xsWDHNTtsB9wevCBq9pLnPXrksbyptPyn0jaB3CFgDdgSYfvNPR8Huc4oLKc8n8DkQj641n0zt+1KkSLgydy3EBHoB7Mfs= X-MS-Office365-Filtering-Correlation-Id: f8fed029-6638-46ab-fe8c-08d5bc9b78ea X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 May 2018 08:43:45.5067 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f8fed029-6638-46ab-fe8c-08d5bc9b78ea X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0801MB1341 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 | 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 e51c6e953d7a..7ae1b94becf3 100644 --- a/include/linux/memcontrol.h +++ b/include/linux/memcontrol.h @@ -1275,6 +1275,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 && memcg != root_mem_cgroup) { + 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; ) @@ -1297,6 +1309,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 cab8fad7f7e2..7df71ab0de1c 100644 --- a/mm/list_lru.c +++ b/mm/list_lru.c @@ -31,6 +31,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) { /* @@ -94,6 +99,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; @@ -119,13 +129,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; @@ -520,6 +534,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, @@ -531,7 +546,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);