From patchwork Tue May 22 10:09:33 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kirill Tkhai X-Patchwork-Id: 10417875 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 D284360224 for ; Tue, 22 May 2018 10:09:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C2B3128B93 for ; Tue, 22 May 2018 10:09:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B71C328BAB; Tue, 22 May 2018 10:09:47 +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 12CE228BA8 for ; Tue, 22 May 2018 10:09:47 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id EB3CE6B0274; Tue, 22 May 2018 06:09:45 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id E64526B0276; Tue, 22 May 2018 06:09:45 -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 D2C456B0277; Tue, 22 May 2018 06:09:45 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-qt0-f197.google.com (mail-qt0-f197.google.com [209.85.216.197]) by kanga.kvack.org (Postfix) with ESMTP id A39CD6B0274 for ; Tue, 22 May 2018 06:09:45 -0400 (EDT) Received: by mail-qt0-f197.google.com with SMTP id n33-v6so17498483qte.23 for ; Tue, 22 May 2018 03:09:45 -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=pF6kRbaGHZMBSu0sG7umHWjjasZSFMQ7aL3LIsn6Ps8=; b=C/rrwF1tjXfOi5eQpDKb9acVbT3IRBXt9kLjn4BnBIN8HCFoCgoT16kCvBn2/B2RtI AHGX79FvvFs2dv2Avdbm0dL2PK5QT1QLGDI56VDTiKL07HY/7KhquqMAR7Wlb/bCbY38 +ZWgib2ZUhICPMG4mXDiqGCs8s6NPvESIIRE4nRwBvLi0KbLZWlxwDMRQffidC/xPujg X8V3yHqRB75oKdcP/v/f2LUIgbBHRzha2JYF1Ecm9eS3BxahSLhR48WMYyMTz/azps4D 9R+8XL0D612OcvInNYkbpntfJgDUSVmwSX6jrdvnA1IIjfXQSEWlTo+LE43ErJc40Yre yToA== X-Gm-Message-State: ALKqPweVx9Wwwj+QeAPxy2Hxym4U/kPHilCclf9hUG4mG+kU3G4O+N/N USTlT1AQO7vyfmSQswJFf369tE66q6SOtpUWhwQRbD6v5EkGIEn+5pVlMu4LTEdg/rLYIP7ywBL SOWElft2CmH7jc7fO95mNA3qZAeIzuNzl0T6Nv3j4F5wJjj5Ofh3HWM8OshsphpPwcA== X-Received: by 2002:aed:29c2:: with SMTP id o60-v6mr21894429qtd.2.1526983785454; Tue, 22 May 2018 03:09:45 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpLtI0XQwjjIexJkWZYj61xTi3c4zbqQdrNEIHunmbJoOO3V5N7bx89NdLxDM8oqvnx5nDL X-Received: by 2002:aed:29c2:: with SMTP id o60-v6mr21894397qtd.2.1526983784834; Tue, 22 May 2018 03:09:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526983784; cv=none; d=google.com; s=arc-20160816; b=GPW5V6b/AXV6FQhdAyr5JlWnPA7wWW+CiajqH61OC+vvX6LeQF6c1iFgfUKth3TVL1 5J+T+1kiR5xo4iAIvKn0ahfVEIUzeIOkc7kbewQHSh9bghj2h4Sqs0JYCEutSAdB4tX1 /OlWHoa50o3kuVR8lFAwB59MSpO5bSVMxNTs2uJRMog0VtM6J6FmBwlrooFOXZyVaFwV lHXVjvmVJn06RvOlUqrg6fD9qfqSlZHHC5lrm/oQpLGRGdkJrTu5XjXkWlDXJ78SZ0pT UDoh2TClXy7aCoxcMaIyQc0n0euBaQdTMfRIzYXMJtQY95KOYDVhd5xnEGYeyrcQ3LWX TivA== 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=pF6kRbaGHZMBSu0sG7umHWjjasZSFMQ7aL3LIsn6Ps8=; b=ecFkl6BhUxWL1TCwcs/8wjHStZUqTsqrGok/EGf2wwN5avqsBdj50Nt4+Tri8fOEES bZ60tKdwsNxvX57/RiRZBVCJVCkb6RxAjFzoRcD7Xm6jOwH028Lfhav5dKAK9NJLmuqL KCgq4GQkGdoonvG70/uuvMh4efybx1RMMA59jqYtGbcPmMuBmTjQSE91w1/b9pc3oZbT J/VI9Wvdd/DNJtYOl2hMzIcxA870/fKQk4uZf91Z/CAn/tdK9xF9HrMD7luQzQNRseT6 1/OIbVOSR/wevBwbUHGk2TA4+1twQt991VvCY85ZODs1vgKUvybH5Ypromgm429bd0Zf v9fw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=selector1 header.b=ITfT5jzd; spf=pass (google.com: domain of ktkhai@virtuozzo.com designates 104.47.0.97 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-he1eur01on0097.outbound.protection.outlook.com. [104.47.0.97]) by mx.google.com with ESMTPS id h185-v6si836086qka.228.2018.05.22.03.09.44 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 22 May 2018 03:09:44 -0700 (PDT) Received-SPF: pass (google.com: domain of ktkhai@virtuozzo.com designates 104.47.0.97 as permitted sender) client-ip=104.47.0.97; Authentication-Results: mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=selector1 header.b=ITfT5jzd; spf=pass (google.com: domain of ktkhai@virtuozzo.com designates 104.47.0.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:X-MS-Exchange-SenderADCheck; bh=pF6kRbaGHZMBSu0sG7umHWjjasZSFMQ7aL3LIsn6Ps8=; b=ITfT5jzdD+mxnKCQoHrESaL26NBY7UW97LjfZhVBbjmUrdnTTSXSkR4Hnm2/2Q9N1aeHGo9EYN1I0Jzk1d1W2d+F1t0AsAti8fmKBipdCAAX4B2pth4vLR3bcG+Whk5s+zCv060HTbGe0nZNolyMuVhTPzRn6qGGu11ga31jfpQ= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=ktkhai@virtuozzo.com; Received: from localhost.localdomain (195.214.232.6) by DB6PR0801MB1333.eurprd08.prod.outlook.com (2603:10a6:4:a::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.776.11; Tue, 22 May 2018 10:09:35 +0000 Subject: [PATCH v7 13/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: Tue, 22 May 2018 13:09:33 +0300 Message-ID: <152698377333.3393.10224542065681526664.stgit@localhost.localdomain> In-Reply-To: <152698356466.3393.5351712806709424140.stgit@localhost.localdomain> References: <152698356466.3393.5351712806709424140.stgit@localhost.localdomain> User-Agent: StGit/0.18 MIME-Version: 1.0 X-Originating-IP: [195.214.232.6] X-ClientProxiedBy: AM6PR0202CA0013.eurprd02.prod.outlook.com (2603:10a6:209:15::26) To DB6PR0801MB1333.eurprd08.prod.outlook.com (2603:10a6:4:a::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:DB6PR0801MB1333; X-Microsoft-Exchange-Diagnostics: 1; DB6PR0801MB1333; 3:ck6/7D5HTF3mjhAxmmJPIEumuq8+WsiR/yjwUv83A8ksELTpUILgzCjMLXzKQAP/kriwlEzQ7tG65PvcZeChRNKVEiBeFl8mJqj9gMOFsd4NQtFMm10J5dI4Yg7RxgIhZ84uXHTFOWExXYeB8rq2fI/HfHPlTCIkTpIiHU0FcJSplYdklDPOQnB83tEf2duzR/3/KfDUz1tyGAsV/wwrBpZUV052sCuowLFN5Xv92G3310t6tGl1ueh+lW6FP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3GpDiVuLS1MfcaeRZ0dcU872nlpaznP4nZ37o9WyO57y/1nnYK7ugmaQXr66o0xlFfpZnd9+swODK6eGEGQmzDGhbqP; 4:rR6HjzOekwXL9qC8EYik2l2RE9cN37FcT1oPXPeDH5pFNyUI74GFO5fxb7wn5Y81eTVmzKp14O91OqnnJwwYqCEYihw482LcrhYeQ8HN6OQE1iL0U2o5NGjOQYjCWCfwJi2BMSMEj6M5dikvj/2RvBYGJCZuj/WH0jhEvhY5XYiTfqViZkYs7syDLm2R1IOyJwF/WRrIvP48iN3vhD0Ql3PYdUpsFAdUh5XGyKYubsHg23aXeCsdARZa5/8WDmHJ+sZB1J6onCQpFW8FeQF0lw== 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)(93006095)(93001095)(3231254)(944501410)(52105095)(10201501046)(3002001)(149027)(150027)(6041310)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123564045)(20161123558120)(6072148)(201708071742011)(7699016); SRVR:DB6PR0801MB1333; BCL:0; PCL:0; RULEID:; SRVR:DB6PR0801MB1333; X-Forefront-PRVS: 0680FADD48 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(6069001)(376002)(39380400002)(366004)(396003)(346002)(39850400004)(189003)(199004)(446003)(956004)(476003)(486006)(11346002)(186003)(16526019)(76176011)(6506007)(386003)(55236004)(2906002)(47776003)(33896004)(7696005)(52116002)(59450400001)(66066001)(7736002)(305945005)(2486003)(23676004)(68736007)(61506002)(25786009)(6636002)(230700001)(58126008)(6116002)(3846002)(39060400002)(86362001)(575784001)(97736004)(8936002)(53936002)(8676002)(103116003)(81166006)(5660300001)(50466002)(316002)(81156014)(9686003)(26005)(7416002)(55016002)(105586002)(106356001)(478600001)(921003)(1121003); DIR:OUT; SFP:1102; SCL:1; SRVR:DB6PR0801MB1333; 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?MTtEQjZQUjA4MDFNQjEzMzM7MjM6U3FyRVhNd2Z5d2ZPYXcwRXlNMGdLS2pK?= =?utf-8?B?ZVNTQThPOXR5NkpqT2c5TmQ1cmNHOFlwRmNQREJyWWM0T0V6ZnB2cldacW9I?= =?utf-8?B?c2R3UkpWUkd3WXBlUnN3dTA0ZzVoNFZWRkNiUk92V3ZKM2wxalRuRDNDTnps?= =?utf-8?B?ZzZSck1XV1ZBNitQNXJlK0tzVUUwS0EzaTNhMDk2Tk4vaVdDblgxYjV5NjhJ?= =?utf-8?B?VjYrN1IyREp0RFJiNVVTMW5ibmExL1BuYmlCNmtRTEVDS0tSNG8xbEwvWXVD?= =?utf-8?B?QUdjNW91SWJMYmRRa0RxN3ViRkFXM3FJZFFkRFQzUUc4SmVhcmxlRXliUnRr?= =?utf-8?B?aWRZbWFuRW5TWGd0bkx0YXZPREd0R055aEk2RDFEWkF3ZGdOem8za0V5RHhi?= =?utf-8?B?TE5lS1J0aTBFdEk0OFFBR0QwLzFXSUxqL0NhWko3SVdZeWNFc1VUVWJJc1c5?= =?utf-8?B?NGdTZ0s5RFVyRFdQNHJSYTZMdlpUcUg1SEl4b0thOFVTTVpsbm1PQWpJN2RT?= =?utf-8?B?T0FndFdLQjh4cmRJOVBoa2RlbHZtSjd4SEJ2cnY3RE9CNlRNRy9IcGV5Sk5Q?= =?utf-8?B?UUVIdW1sT2xoSStLS09JZnZ0UkpHSFl6WkFGOTJRdTNjaERjWHcwQjZ2aXBl?= =?utf-8?B?eGJDMVYwKzdnQTkrM2k5ZlRzMlM2ZTJrejdoYUplKy8zSENVdnhCTDllcW9l?= =?utf-8?B?MmxMRUdqS1kwNWpFKytjL01uVSszNE5pU1crTHBlWUU0VUh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7ecufXkH4/4s/j17LqDtgEWjElxtrcAQ07/0e2tUVP4TXTCfXamzUmZGY9KQGCzyhThzQHjw=; 24:vJ6+3QiuJ+7EO+s0jylzam3SEddTiCHf7cBjlUhq0VAj+lCyy6N9DfwWJH3Ft4WIv0qOtMemAoT8L/m7bvClgK3aTWP/baWNpNkIB+fBgkE= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DB6PR0801MB1333; 7:illZNxmP6QQvtqSUILsFICmq4lm3lMz6mqRj/FsgM8tnMjj7NAzOKxLNNfKatOKKDq953v36H4gPpk7lA3AddRw1NvhQtNGIwU8SzRKRkCl2aec1aHRqW+QsmxIoLzaAlY8JGKGnn4mr3JaycxtezIpW8XJgCmuWUeFZIRoAS3+H6c9XCZ4xDBF/NlxVkmQsrOE2UuD24s8ecoz2RnLoHBCuaiiyPNQZIwPyYzJ/DjzlpQJIdBuEJJ7EmmObRaXX; 20:D2P73JXqPYZClmNlztoMTA6P6+odpy7NAD20SCEip4vUSH4nc4k6pMhmQIzu3s70CeVIgrpoaOajsdoVOI3llUe2i5+0K21cgy8UWFdJhmsDxVVJoJMM+u6LFgc4UPvHOh/4FMUVp0xPxmSEYWPpn8wagDk5fgka9vYPb3R4snY= X-MS-Office365-Filtering-Correlation-Id: 92f13e3e-1b31-4e6f-864e-08d5bfcc201b X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 May 2018 10:09:35.6325 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 92f13e3e-1b31-4e6f-864e-08d5bfcc201b X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0801MB1333 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 24abed028c6e..b3ae1373c99a 100644 --- a/include/linux/memcontrol.h +++ b/include/linux/memcontrol.h @@ -1285,6 +1285,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; ) @@ -1307,6 +1319,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);