From patchwork Wed May 9 11:56:55 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kirill Tkhai X-Patchwork-Id: 10389245 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 3469960318 for ; Wed, 9 May 2018 11:57:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1FC9C28BC8 for ; Wed, 9 May 2018 11:57:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1407B28EA3; Wed, 9 May 2018 11:57:06 +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 6865C28BC8 for ; Wed, 9 May 2018 11:57:05 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5245A6B04F3; Wed, 9 May 2018 07:57:04 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 4FA806B04F4; Wed, 9 May 2018 07:57:04 -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 39BD96B04F5; Wed, 9 May 2018 07:57:04 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-io0-f200.google.com (mail-io0-f200.google.com [209.85.223.200]) by kanga.kvack.org (Postfix) with ESMTP id 0978F6B04F3 for ; Wed, 9 May 2018 07:57:04 -0400 (EDT) Received: by mail-io0-f200.google.com with SMTP id 76-v6so30449594ioh.6 for ; Wed, 09 May 2018 04:57:04 -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=ReO1K0uzur+DPV3GXq1aDtljGEAZujiX16BIbdadejk=; b=d0dAk3epS9EfKkEN3tFxYL4HYsaN4v0IXAr5U0cgzrGF1c3QqPLGj/4mNGYIzQW4p0 Z66O/uzM7vqNdzQ52zjC3kjHLDTR3sFv7jGJszHNluImtTZJ9TbgU5pKMttxpq3s4WcB sDYB0rpi3Inh8x4b81Y1GO8jq+Cp6nTcJFoGd/LneaUoM55yF8ArKjtwsQ4V3ruHq4eI 0vvbMtMiYvYEhijlSpsskv512lCkYhpA5W4/AlwkGO9lp0ErW4HeF3iQthucuc58M8dp YcWNGpmNm7pJyPk+qGRGTw30zlI9UwRo1PQWCuVlRh2wd9uwE6aGIEN3txeVN4ViBzPe XOww== X-Gm-Message-State: ALQs6tA1ynYiqhmCjpYlv/FsBQ5usu7mHnZhAlVdPwu4Hk/pN2No5XAM d/mf1H/ssLB84U6S0REJOSVyDbM8NUIqEt8iJWe+/RWDAUbSzHjRMpxYl8brouibCngjZAkr6nY 9y+j4MtSx2j2T40bEWQHkc5AyO5n6W3EuXB0iJW7fDG2zcCPqgPlkdZkE/WoWV4CPCg== X-Received: by 2002:a6b:440c:: with SMTP id r12-v6mr48078186ioa.126.1525867023786; Wed, 09 May 2018 04:57:03 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpdf0wHb3B7EHP8/JK2Y94XLuTiSmeHvXeKSJb1Laz3qm1aD9tv3nyivyBGlYoRz5s0XHb/ X-Received: by 2002:a6b:440c:: with SMTP id r12-v6mr48078128ioa.126.1525867022889; Wed, 09 May 2018 04:57:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525867022; cv=none; d=google.com; s=arc-20160816; b=j6HqX3y69EKwtXUXpBafAYuXkSOUy4ZQ2yYoGa6PvsjmwZtg/d+S88Es0I50zBhgD8 FZWf7U2tW4IDAHd+sSXFwiriwaZ3glTNX/8glrzQ4W63O2Esp1BcNwWbxpS8HuK+uZin ZiGJEcrMuSMnhPqMUxvyn1jMFqZ/nxaTD7Tg6s3soSB3c/rrPi1VQggt2zKsDJ/ZujHA CWN3sM/rrmwGNbECNdR5w0pegQlNl8mJG+IFfXL8ep+Y36ZienlLHJryayJaahge+wOL EUbr48ZCoizYtD6AyTglrhYLR9QVlfkFOCeNy0GLXRSWysTrU09zZFCKvdmUdCJqJMCm doPQ== 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=ReO1K0uzur+DPV3GXq1aDtljGEAZujiX16BIbdadejk=; b=KAnW8E2dL0RAFdvqakDIvMaNtQQNtU3R81L3v0Sg8OwmE4mmWMVHihrADdvygNHcqK aaQIyOsOvD7MlRXenhzWTRsrz12tU3vpqfk/izaMGvk+xjpa3aTXQm9dNUXouNdXE1J0 1g8GJyE/5/9KTyifdeNC2j1tERFgQBrjOkefghM0XYXDI8A5yH/WRh9Kx8Zas1vuiiSf Ad5+WeyxDXSmtK4BkDrPR7oVDPAztaO9euB1U4BEDD6OPClOcPzWHN0p9XHybL6/o2YY ONYVmDdNJAbAz0GvzQlrNBb0QJgtwZDVj2rK0cG8OVbKesPMSfth+N3qrqVsgMKtmi2D t8gw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=selector1 header.b=VAbbuk0z; spf=pass (google.com: domain of ktkhai@virtuozzo.com designates 104.47.1.109 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-ve1eur01on0109.outbound.protection.outlook.com. [104.47.1.109]) by mx.google.com with ESMTPS id a130-v6si11955523ita.84.2018.05.09.04.57.02 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 09 May 2018 04:57:02 -0700 (PDT) Received-SPF: pass (google.com: domain of ktkhai@virtuozzo.com designates 104.47.1.109 as permitted sender) client-ip=104.47.1.109; Authentication-Results: mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=selector1 header.b=VAbbuk0z; spf=pass (google.com: domain of ktkhai@virtuozzo.com designates 104.47.1.109 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=ReO1K0uzur+DPV3GXq1aDtljGEAZujiX16BIbdadejk=; b=VAbbuk0zrOQbHkpsbZgfvXvGRNg/LFPeLE9aFsAhmkEht+frhf6bXp4tiSiChtpmUIAVkO7RXxUVW8FeLiKaP+SjDAuiWh6bOZSb1EYFvzwAyA17+JLCR/YtPlWnFCf9DsDCMczdQL+TADxPwJLXkHToQrTfWKi0mp9Gu75hViM= 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.735.17; Wed, 9 May 2018 11:56:57 +0000 Subject: [PATCH v4 01/13] 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: Wed, 09 May 2018 14:56:55 +0300 Message-ID: <152586701534.3048.9132875744525159636.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: HE1P191CA0004.EURP191.PROD.OUTLOOK.COM (2603:10a6:3:cf::14) 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)(4534165)(7168020)(4627221)(201703031133081)(201702281549075)(5600026)(2017052603328)(7153060)(7193020); SRVR:VI1PR0801MB1341; X-Microsoft-Exchange-Diagnostics: 1; VI1PR0801MB1341; 3:g+Bk14rwf58BT1o/7iyHC0Q7ijDllXC4F2b1LnNF+id6Os9J5N7mozfI0QeOJBD9FOX/o9zbICwy5oeBUCgtaCai891GsjqohdwWdCW+ECq6W2WvFiZhAbtUB9i+vJiRCDAiNrXZavoM1dPvlG3qWVvNh9xHPHy43fHigfxNHkVfeKQjXaqCp+xuqSIi1WYgUKRQdueZC4IUZ41Zdv4suFna/BxKf1swDFaqUdJc7O6GgGLMQ/fml19+XRhROed4; 25:q3F1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AHHfFi2vrXPCaio+mzVYZiKHLUiuov/oKboMrmHQO/xEyEsIUHC5G6LHkg5gzrbj1+/vbG9atmBUC/Rs4cplr8Vn; 4:LofXhnYpgsGR7RKYakqJep7u83vkoYqdXPgmWiQBRetlu7V/3pCIzBHXPb48YL1ZinjqR8rRl6LV+pxzsUv5A4eu777lnHWvYTWDddwGjEQMEWy1Rbo5ceaiD2j9MiR5fMtOHMTQ9EoyYq0EDuO9jU70lxDPRwRx2aWFoVWf/AQh8ueWlcamUw5orsfTQXNEJXCVhM7gDxptHfLsA0AbVjgHGiJP36Ya3hcVwKzqy1EBcy6EKUVpF4yD+BUoNtya3Q3RGGlL0i9AaTRFwZz12w== 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)(93006095)(93001095)(3231254)(944501410)(52105095)(3002001)(149027)(150027)(6041310)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123564045)(20161123558120)(6072148)(201708071742011); SRVR:VI1PR0801MB1341; BCL:0; PCL:0; RULEID:; SRVR:VI1PR0801MB1341; X-Forefront-PRVS: 0667289FF8 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(6069001)(39850400004)(366004)(376002)(346002)(396003)(39380400002)(189003)(199004)(25786009)(6116002)(68736007)(53936002)(3846002)(97736004)(476003)(11346002)(478600001)(50466002)(486006)(956004)(6636002)(7736002)(55236004)(9686003)(47776003)(186003)(8936002)(5660300001)(26005)(446003)(52116002)(386003)(305945005)(6506007)(2906002)(59450400001)(76176011)(230700001)(66066001)(316002)(7696005)(61506002)(55016002)(81156014)(81166006)(33896004)(105586002)(23676004)(16526019)(8676002)(2486003)(86362001)(575784001)(106356001)(58126008)(7416002)(39060400002)(103116003)(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?MTtWSTFQUjA4MDFNQjEzNDE7MjM6TGpkSCtiTEkvMkhmeWhsU29PN3l1cDJz?= =?utf-8?B?cFgrMVZOd3dsRWhZVzVkVDhHUmNiN0l4Q2FlSHBVL2hpZnpEdXFRbVVWeHJV?= =?utf-8?B?cUx4cUpOKzdSMm5laktJUnFvU2R6NFlHajlpcjV3T3hWc3VxbExLRWQ4cklz?= =?utf-8?B?Y2Npemx3bzN2UkhVMktDVGVnY09WQnVranhONS96V1d1NlNWcEVnMVIwZVlW?= =?utf-8?B?NTdCVXpkOHhpeGVSZCs3bHdOc2daQThVY1Z1eEp5dHk4ZUtwK0hLdFkyeXQx?= =?utf-8?B?SjNwSE55ZDVhaDRtVXJTRzkwQTE3SVdPbzRDV3Q5QzlGemUveFJEYnJ2cXQv?= =?utf-8?B?VXRiSVFhL0Foc3A2M05LUEYzNEY0RS96YUxYZzBxMkwrM3pHckE0Sk5jekVp?= =?utf-8?B?ZDEwMjdEU01XVXpCeU1YVTBoVS81YnhJT2paQm5hckV3SEVIeVJOaUdxcEV2?= =?utf-8?B?WXdqNGFhQk04RFFZTGZXV3FBQ3ZyV3lMTERzc2I4VGlqcmUyYXdNOFlqL0I5?= =?utf-8?B?Z01tTDJrSzJITVJqS1grNExzcWliaG5ab01OSi9SZjJjRXBQV0RVbElVS0Yz?= =?utf-8?B?cEFzYW42SENQMHZtekZITHZheHR3Q0w0OWNJVEU2QUExU0Rsa2oyTEtlMG1T?= =?utf-8?B?UWhMNVhVQlA3ekhieHRNa01oV0dUZ0hlaklrdVZWWEpYWjRkTXFPK2V1akZI?= =?utf-8?B?MWFKYW5TTW5lSlRpbS9xMCsydXhNT3hJY3VRTDE0RFNBUU9NSEJjZGxPSjhk?= =?utf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jgTmpMl+/TE61C14GeBmmTi27vw+MtkVhnIc=; 24:xUonnEC84SPO7cyLYOxyx/LESz0dhcgiNjquBbOTCyh+Yb2+VNcF0ETqFemjdTR33Ion1bmYLvX50m7Ycwipqx7ogGnBh7s7rJbp1rRl5Ko= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; VI1PR0801MB1341; 7:lMt7oK6FsvF2QglUawWEOdV3DDWo92tx9ufpA1qZqWXl1bxgL42XvN8yHWdeyCBxCWgdJANIEQTA0Zisc/8QE0Ab7I1EEeMpbbtGdeMHHb8PFjG1V2jJJi8cbfEYfPcCpo5+yoCllyn9NOLePxV+XGJHCQ3EyVdPutDl3QZEB84IeVGx2UCfLfJeCNIl1iiOJ2A12GyjwYfJN6ZzZIkNkfm1xfkcZnHv3za7OeffLQolfpSfqY9O3NybE3A1mWd9; 20:LTrrYN2IyLGxQMzNuqrKKrCvmrgPnF2i0n8V0kFTE7FV82vPMSPZ26SHSkOQ+OJyz39Oa60ObmHaxnb5PpLO6vQJqRfU+AKTojeFQoSmFKm2ZzmgGEW/kAvqlo1egvILu3jxXCWIQ4xzFof/emT2woHSZYH38wHKD1/qoMhwcco= X-MS-Office365-Filtering-Correlation-Id: 99a2b954-860c-4507-b74a-08d5b5a3f8a5 X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 May 2018 11:56:57.9480 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 99a2b954-860c-4507-b74a-08d5b5a3f8a5 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 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. Signed-off-by: Kirill Tkhai --- fs/super.c | 3 ++ include/linux/shrinker.h | 4 +++ mm/vmscan.c | 59 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 66 insertions(+) diff --git a/fs/super.c b/fs/super.c index 122c402049a2..036a5522f9d0 100644 --- a/fs/super.c +++ b/fs/super.c @@ -248,6 +248,9 @@ static struct super_block *alloc_super(struct file_system_type *type, int flags, s->s_time_gran = 1000000000; s->cleancache_poolid = CLEANCACHE_NO_POOL; +#if defined(CONFIG_MEMCG) && !defined(CONFIG_SLOB) + s->s_shrink.id = -1; +#endif s->s_shrink.seeks = DEFAULT_SEEKS; s->s_shrink.scan_objects = super_cache_scan; s->s_shrink.count_objects = super_cache_count; diff --git a/include/linux/shrinker.h b/include/linux/shrinker.h index 6794490f25b2..a9ec364e1b0b 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; +#if defined(CONFIG_MEMCG) && !defined(CONFIG_SLOB) + /* 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 10c8a38c5eef..36808bdf02ae 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -169,6 +169,47 @@ unsigned long vm_total_pages; static LIST_HEAD(shrinker_list); static DECLARE_RWSEM(shrinker_rwsem); +#if defined(CONFIG_MEMCG) && !defined(CONFIG_SLOB) +static DEFINE_IDR(shrinker_idr); + +static int prealloc_memcg_shrinker(struct shrinker *shrinker) +{ + int id, ret; + + 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 del_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 && !CONFIG_SLOB */ +static int prealloc_memcg_shrinker(struct shrinker *shrinker) +{ + return 0; +} + +static void del_memcg_shrinker(struct shrinker *shrinker) +{ +} +#endif /* CONFIG_MEMCG && !CONFIG_SLOB */ + #ifdef CONFIG_MEMCG static bool global_reclaim(struct scan_control *sc) { @@ -306,6 +347,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 +355,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) + del_memcg_shrinker(shrinker); + kfree(shrinker->nr_deferred); shrinker->nr_deferred = NULL; } @@ -347,6 +404,8 @@ void unregister_shrinker(struct shrinker *shrinker) { if (!shrinker->nr_deferred) return; + if (shrinker->flags & SHRINKER_MEMCG_AWARE) + del_memcg_shrinker(shrinker); down_write(&shrinker_rwsem); list_del(&shrinker->list); up_write(&shrinker_rwsem);