From patchwork Fri May 18 08:42:08 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kirill Tkhai X-Patchwork-Id: 10408753 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 60050602CB for ; Fri, 18 May 2018 08:42:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4EA4428707 for ; Fri, 18 May 2018 08:42:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 411ED28885; Fri, 18 May 2018 08:42:29 +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 64AA828707 for ; Fri, 18 May 2018 08:42:28 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5BC4A6B05A4; Fri, 18 May 2018 04:42:27 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 56D396B05A5; Fri, 18 May 2018 04:42:27 -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 40ECB6B05A6; Fri, 18 May 2018 04:42:27 -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 F1A086B05A4 for ; Fri, 18 May 2018 04:42:26 -0400 (EDT) Received: by mail-pl0-f71.google.com with SMTP id e1-v6so3220041pld.23 for ; Fri, 18 May 2018 01:42:26 -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=6uPHp3B9cdoINQJ4fiXhav0uuPNAVay+O/UDNFBI8vY=; b=XAnJ4L6h+AkHdJ4RLuDSfxtOrpuwtkHFFp3SAG5Lvla4RWP+oTskr5K7t3QvtM5g4r gC+TJxf/AkxhMLw4E6lMh3cSqgCkkNBm7sb8gAKn1SpXK4ZyF1RIEMbiai8/4PyjU7RR vW1BzDlvHEbKx6hiGApgcH0iFeKV+qgQDcyEJuWOP86wQlZzRYZG+2Yv5tPTeWiv5ztT LQuu3ZxqyYKJ26hqPUVxcK1vNKqCxNjhryYEsGFQ1qS/U3v482IXwAlyD0kNB6v6MVLu lQyUJ+63O50VJax7VUKZ9UGZ1cZYpjd1LXBK2NA91HgMIjElUpskUR4DiravOONrXhyU Oo8A== X-Gm-Message-State: ALKqPwe2N/5Ud03BhlVVwIq358sFsvVpHYvthqEcW+MEQu9ShqIM2EGp 7lSTYui+8GVf6F7JguHohe6lFbsLfcNq9p+s9B/xA9aPD8uwHPaH3QKoxMyGBT5+joReKTkcYtx ktWhTMu3t/6xXEBMLPmFJJiL6dBA3x0C8mAFPIvmg2aoi3BsVXz9uF/S9bm1Z4W6izg== X-Received: by 2002:a63:af19:: with SMTP id w25-v6mr3473120pge.247.1526632946657; Fri, 18 May 2018 01:42:26 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrxHD2CC/4dyflRSw+7Uf2qCEJXYRudx+QMhbDRZHfuXTrf98Yz8ZFEMr0wTuiUK0UEp0gL X-Received: by 2002:a63:af19:: with SMTP id w25-v6mr3473082pge.247.1526632945789; Fri, 18 May 2018 01:42:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526632945; cv=none; d=google.com; s=arc-20160816; b=UfRM6Q42CF2Epp+WiRdbMUivw7WuXC+g0uk+SZK13hD14G7vwTl7BMHvuP4PT0TIpR 1M0PLb0wTdXi1RuCmQtFodtJ3ppfeudkXFEM5NS+/lZAkp00GTofmzVFDDX+kCGXbqz9 4twvgKhoYHO1OFsYe3m5OkNRHIPcvN2a2V8ONbi3Yll6qXpCrFRqSObrIp8WMg2Uggwy RSk5qkJ/bdVyZR8q5wBTKcyofIaynU37Of3k23TvSvGP7COnxhpjekjFP8P+sI47dv/n AtuK6pYz5QPUfiytNdaPXJkyRIlvVJpHt8mNoyLPrFgk9YfudlzF+LNj6y2MiKF4bYfg s3Ig== 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=6uPHp3B9cdoINQJ4fiXhav0uuPNAVay+O/UDNFBI8vY=; b=I6zkWlff0ZuHgOlBwsFj14O3UhU7O0lNia5jA3oG04bmMgspwfeHs33JuJcaV6sZYL oYs8r8qHSqlmg6bCtRsby7hXXnt6cNdNgCuby88XNWEmd7j6MShj2V7ls2UqFllktUNx 6o0snwp8XiU5FFk1ecALQaI7oFlL2mHwf5V6pAw1gy3HYHYjp4DMlzh9/yyabrYdBDrE eEdgHRSrAcvKizeXveyj5XGya5kR9P8P48qYGidK1sHC09X2E03x06cdd0dUbIldnv5j wDKPH6GpJKkM+8dU7eH0Xxrlk94ONeu9z47FRbd7k9L5sWTp5hx9QEz3TUFeY9MewRKc i/Wg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=selector1 header.b=JtxLJAzr; spf=pass (google.com: domain of ktkhai@virtuozzo.com designates 104.47.1.105 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-ve1eur01on0105.outbound.protection.outlook.com. [104.47.1.105]) by mx.google.com with ESMTPS id f91-v6si7113754plb.510.2018.05.18.01.42.25 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 18 May 2018 01:42:25 -0700 (PDT) Received-SPF: pass (google.com: domain of ktkhai@virtuozzo.com designates 104.47.1.105 as permitted sender) client-ip=104.47.1.105; Authentication-Results: mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=selector1 header.b=JtxLJAzr; spf=pass (google.com: domain of ktkhai@virtuozzo.com designates 104.47.1.105 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=6uPHp3B9cdoINQJ4fiXhav0uuPNAVay+O/UDNFBI8vY=; b=JtxLJAzrKDNKzcS9faQ0W49n4skcDVz+QqLIF8AMPF1NJ/VM5NAwsoDA/t9j4pvxsSeVH2o4ud0MBni69VJ2qA9gDQzWBqSVu9VZzNiWHnCQyuUYDsaZaBS3fd3Mug/nGeDUiz2OXi30KLIfb9LKNZK7nDjVUwJfDvgdHQgf6zE= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=ktkhai@virtuozzo.com; Received: from localhost.localdomain (195.214.232.6) by AM5PR0801MB1329.eurprd08.prod.outlook.com (2603:10a6:203:1f::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.776.11; Fri, 18 May 2018 08:42:11 +0000 Subject: [PATCH v6 03/17] mm: Assign id to every memcg-aware shrinker 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:42:08 +0300 Message-ID: <152663292827.5308.15476497557507652648.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: HE1PR0301CA0007.eurprd03.prod.outlook.com (2603:10a6:3:76::17) To AM5PR0801MB1329.eurprd08.prod.outlook.com (2603:10a6:203:1f::7) 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:AM5PR0801MB1329; X-Microsoft-Exchange-Diagnostics: 1; AM5PR0801MB1329; 3:AvJ0aROTpVH2x0j5eo8ycmogvva96dNNPmOo7z2Y8rZfRe/vhQlj+mmsMlBfUP0mO2inyjz8/S61G+GGV4A5bv6X6igseoCWwYI5awipWdSphU8FJGwmh3m7fNjHXQiHnPMx5TRPmpyKNrNF34PSBZ7S8rG2JlbAwZOaEz3QvJZr2lo/3lLbVypptVEGbB5D4jOLobI87aoyup7w21jt+Ns1fgNQfpYIZLPb3gLa2NZxV7sqy9gs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lvdls1qsZoOd89yVr9lIOHsLQDfTvpXpQw/VO4dCNe7ljcOp3ZcT5GNoL2HIQ3E1JYz47Uqc/4Jl96g6Eu4U1cJhSjbvgOKVSaEEJEoNej; 4:g2jR0oKhwjnJqj34dY7Tn5H5m7DnTQ0fGuLe4e+aYYTmof0j8f8Oi+MqfP4KI8Zf6d8M4eqQy3ZlzcPeGo8RwlfP6MA+8ZgjQNIke5EkWr2kGevD84eFF3DAu7s/URNKzg9kURb1QJ/NArKh6h0K1h7YA2lxcRcMXYbHBi9Tt58mUjIwB/61lzSVhLb2/CclEsrFT6++B2FeL73cwrw98XPm+KTZfVqfWRwaxc1CO3MXdpcX1rybwGGXgLMzG0ZjnvIYjb5QdPZ4R5YQRyakaQ== 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)(10201501046)(3002001)(93006095)(93001095)(3231254)(944501410)(52105095)(149027)(150027)(6041310)(20161123558120)(20161123562045)(20161123560045)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011)(7699016); SRVR:AM5PR0801MB1329; BCL:0; PCL:0; RULEID:; SRVR:AM5PR0801MB1329; X-Forefront-PRVS: 0676F530A9 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(6069001)(396003)(366004)(376002)(346002)(39850400004)(39380400002)(199004)(189003)(386003)(6506007)(9686003)(33896004)(55016002)(956004)(59450400001)(97736004)(476003)(86362001)(16526019)(6636002)(6666003)(53936002)(486006)(2906002)(11346002)(81156014)(106356001)(105586002)(8676002)(186003)(305945005)(7736002)(55236004)(81166006)(39060400002)(8936002)(26005)(446003)(103116003)(52116002)(5660300001)(66066001)(7416002)(230700001)(61506002)(7696005)(50466002)(68736007)(23676004)(2486003)(3846002)(6116002)(47776003)(25786009)(76176011)(58126008)(478600001)(316002)(921003)(1121003); DIR:OUT; SFP:1102; SCL:1; SRVR:AM5PR0801MB1329; 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?MTtBTTVQUjA4MDFNQjEzMjk7MjM6Y2pYOTdZSGNlZ2lRNVN4eS80bmptNG9X?= =?utf-8?B?QkZqN3daNkk4RGNveXVpUTRIcXgyZ1BzNEhZZTQxUDlTV0t3U1JRa0VzVnU1?= =?utf-8?B?SS9GZlFzZFExbGwrOHVnVnhHUEd5MWtscE9DeXYvdWVjUHRoYVhwM3drTEdJ?= =?utf-8?B?Y2thZ1IrMXZ3VThHakNYcTh3RzF6ODhHMUNnMFhwWnVZUWo2SVVwY2NXaTIv?= =?utf-8?B?SW0vSkRPRVIrTnJ5NXgraHBJbm55RmxpOVU0NUsyS01VeCs5YlVVdU9Mb2JW?= =?utf-8?B?UGFOOXhjOXdRS214U1lzWTNqSnppbm85dm9ZMGhrSTJQNWp4bFFueGdpWDVY?= =?utf-8?B?SCs1MElicEl3czB3QUxvTUozMklwOW5QdUpKcmZaTjRIQW9ZaGM5Zjcrb2JT?= =?utf-8?B?YWY5V2VZZXBCUTFIUXRLQ2t4eGFkbEF2QzhZdEFSN2tKYXdDbEU5eEhDdGhx?= =?utf-8?B?RHZPdWhORUF3dUxHVUk0aUhQSUtYUFZQT2hxQzV5dzU3YkhsZUUzTVl2dWVD?= =?utf-8?B?NkRnblNGdUIraGJWcXdzYjV4NmlkdTA4OHNseWUyeDZ2TlJhSmVnNEZ4bEdO?= =?utf-8?B?N3NNUXZGeFVYYUl0OGhMaytXZzdpSzhQQ1BNN29hc1NnRXNYY09lTFdpNzF2?= =?utf-8?B?eVE1MnR5eFA5UEhFSWY0b3BwYnUwTVNneFhacWlNT1dFSDdjUFVJNHUyL011?= =?utf-8?B?TVFWUmprclc4UGVMcGlIQWE1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/NduhWtna3iePW7u+3y3QPlImL8mmrj6nvSJPcYZqKFb5x6B6Aa7q/BzL0Ld1IMaynqEg9B6Xghnos/VsBZw9gm9iKzgANnT2SoqFzbWYQu8ZX0M=; 24:rJQ1i35f2xQ7NbCBJMu1ywC8g8hcvzqb11MHq0vaMnnd5kLjGk6CRbVKIPLY03I0z0R+AiVHBlbvvqwLZrIzgY+a4Yy3Wm1VDTMWELWKYyU= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; AM5PR0801MB1329; 7:/1StyrEda/eKQtwhugv7Mrlym2H2f357Mp9P8HY0E+MK+C9JW0FvKDIHLtYzojtwQW/opQ4EK264LZ9tacKuj8kmpf/B6PiPzRe9eYQP+MuzbQT222kUZ0UMc+W6E8jOrAfRHW7aFdMENvBtiUFipz/FKCp3dZ/Ap96ngV20b6luWbA59fzV0yvNcus2U4M8TYi5SG7LgzwUlIF1LRaf8a8QfZia8+i0wLbEtR4Y1z4RkoyDBvF/8mNE8nBgxRpj; 20:11CmJSo+0iWqAjJq0+vdGeOUaXmPT7zd7c0KRXF44JJ1IK5Ohk4QwPbQF1JLuy9DWBRaASZkLhAfydPvN4kKJWODM32XXhTwsn7kSiAorxfe7HaioxHLF7ZDuDjh6J5cLSaZR8AhyqY7ah8NykHXOTSfZeU+RLxJMRc43fG+3xQ= X-MS-Office365-Filtering-Correlation-Id: 6c12a0bb-3bfd-4767-d66f-08d5bc9b41c7 X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 May 2018 08:42:11.8734 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6c12a0bb-3bfd-4767-d66f-08d5bc9b41c7 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM5PR0801MB1329 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 The patch introduces shrinker::id number, which is used to enumerate memcg-aware shrinkers. The number start from 0, and the code tries to maintain it as small as possible. This will be used as to represent a memcg-aware shrinkers in memcg shrinkers map. Since all memcg-aware shrinkers are based on list_lru, which is per-memcg in case of !CONFIG_MEMCG_KMEM only, the new functionality will be under this config option. Signed-off-by: Kirill Tkhai --- include/linux/shrinker.h | 4 +++ mm/vmscan.c | 60 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 64 insertions(+) diff --git a/include/linux/shrinker.h b/include/linux/shrinker.h index 6794490f25b2..7ca9c18cf130 100644 --- a/include/linux/shrinker.h +++ b/include/linux/shrinker.h @@ -66,6 +66,10 @@ struct shrinker { /* These are for internal use */ struct list_head list; +#ifdef CONFIG_MEMCG_KMEM + /* ID in shrinker_idr */ + int id; +#endif /* objs pending delete, per node */ atomic_long_t *nr_deferred; }; diff --git a/mm/vmscan.c b/mm/vmscan.c index 50055d72f294..3de12a9bdf85 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -169,6 +169,48 @@ unsigned long vm_total_pages; static LIST_HEAD(shrinker_list); static DECLARE_RWSEM(shrinker_rwsem); +#ifdef CONFIG_MEMCG_KMEM +static DEFINE_IDR(shrinker_idr); + +static int prealloc_memcg_shrinker(struct shrinker *shrinker) +{ + int id, ret; + + shrinker->id = -1; + down_write(&shrinker_rwsem); + ret = id = idr_alloc(&shrinker_idr, shrinker, 0, 0, GFP_KERNEL); + if (ret < 0) + goto unlock; + shrinker->id = id; + ret = 0; +unlock: + up_write(&shrinker_rwsem); + return ret; +} + +static void unregister_memcg_shrinker(struct shrinker *shrinker) +{ + int id = shrinker->id; + + if (id < 0) + return; + + down_write(&shrinker_rwsem); + idr_remove(&shrinker_idr, id); + up_write(&shrinker_rwsem); + shrinker->id = -1; +} +#else /* CONFIG_MEMCG_KMEM */ +static int prealloc_memcg_shrinker(struct shrinker *shrinker) +{ + return 0; +} + +static void unregister_memcg_shrinker(struct shrinker *shrinker) +{ +} +#endif /* CONFIG_MEMCG_KMEM */ + #ifdef CONFIG_MEMCG static bool global_reclaim(struct scan_control *sc) { @@ -306,6 +348,7 @@ unsigned long lruvec_lru_size(struct lruvec *lruvec, enum lru_list lru, int zone int prealloc_shrinker(struct shrinker *shrinker) { size_t size = sizeof(*shrinker->nr_deferred); + int ret; if (shrinker->flags & SHRINKER_NUMA_AWARE) size *= nr_node_ids; @@ -313,11 +356,26 @@ int prealloc_shrinker(struct shrinker *shrinker) shrinker->nr_deferred = kzalloc(size, GFP_KERNEL); if (!shrinker->nr_deferred) return -ENOMEM; + + if (shrinker->flags & SHRINKER_MEMCG_AWARE) { + ret = prealloc_memcg_shrinker(shrinker); + if (ret) + goto free_deferred; + } + return 0; + +free_deferred: + kfree(shrinker->nr_deferred); + shrinker->nr_deferred = NULL; + return -ENOMEM; } void free_prealloced_shrinker(struct shrinker *shrinker) { + if (shrinker->flags & SHRINKER_MEMCG_AWARE) + unregister_memcg_shrinker(shrinker); + kfree(shrinker->nr_deferred); shrinker->nr_deferred = NULL; } @@ -347,6 +405,8 @@ void unregister_shrinker(struct shrinker *shrinker) { if (!shrinker->nr_deferred) return; + if (shrinker->flags & SHRINKER_MEMCG_AWARE) + unregister_memcg_shrinker(shrinker); down_write(&shrinker_rwsem); list_del(&shrinker->list); up_write(&shrinker_rwsem);