From patchwork Mon Jul 9 08:37:44 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kirill Tkhai X-Patchwork-Id: 10513927 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 99258604D4 for ; Mon, 9 Jul 2018 08:38:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 82E5628A58 for ; Mon, 9 Jul 2018 08:38:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7696F28A5A; Mon, 9 Jul 2018 08:38:00 +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 2F51728A58 for ; Mon, 9 Jul 2018 08:37:59 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3A93D6B028A; Mon, 9 Jul 2018 04:37:58 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 32F046B028C; Mon, 9 Jul 2018 04:37:58 -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 181636B028D; Mon, 9 Jul 2018 04:37:58 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-qk0-f200.google.com (mail-qk0-f200.google.com [209.85.220.200]) by kanga.kvack.org (Postfix) with ESMTP id DCC3D6B028A for ; Mon, 9 Jul 2018 04:37:57 -0400 (EDT) Received: by mail-qk0-f200.google.com with SMTP id s63-v6so21292069qkc.7 for ; Mon, 09 Jul 2018 01:37:57 -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=+mfdH0iH0DaLkrWSziKCI0u112NKWqMjP+WeVBtnVk0=; b=ewIMSda0Y70lF8qGMy9dXrFDs/nTd+1TcSzgou7SIHBRb3mHCnTS6H+8eGc1tFl+1P XWCvIeRvqp4ib0q9U4FFo9gOXDx59kYHSXiPpj2UVvaNuVpNkRx67RmF+522YWJUdozI RNCEF9A/xcqI6ruLdGc3PuZ6KnPM8UbqGotpgIWkUmUGdQ92Idkgm84GcoMg8ul5cV2j r5tOlK/8LslPW434GK34xGEWY+Bs8vUkrHbZoc+WpnyoJu749xkClOjuwsrPQ4BZvbQu HgEgNAOvSoGKmmUThold1G/9dz3+noE71+yD1rfB10hTdwBkYN/O6dlX4cnhj69UzwKG 7NrA== X-Gm-Message-State: APt69E25j1AYQuNwxRWdfnOodgqvvpqwS7P2qpIwNmah+99v+qe0IftQ NCZVQWNUu321fY8prmIY/pi98Wdqo+Io2nsPKrljwn4O+c1E2V+GQiVqJlbKuewwyqPeR5vd2bE NDUriI5+9bSbW0jpcPny7y2+A/QDxTTsGV538i24g1MsbSN0vN43eRPn5PSQhrK38Bw== X-Received: by 2002:ac8:3615:: with SMTP id m21-v6mr18688095qtb.297.1531125477613; Mon, 09 Jul 2018 01:37:57 -0700 (PDT) X-Google-Smtp-Source: AAOMgpf/pW4pVAFfhwAN0oweoPImGAorN5FalHta02DhLUzuy1SXfK8jzO6gNC7y7aYLUod0K44h X-Received: by 2002:ac8:3615:: with SMTP id m21-v6mr18688079qtb.297.1531125476978; Mon, 09 Jul 2018 01:37:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531125476; cv=none; d=google.com; s=arc-20160816; b=O7+mBnS8Px4LD/6y872CsdMn2sPCccASPQ6s6jJITadTdYHObr6yXDXFXSfOcEWybf 0FdSLbOWLxsEpJDFZh/+uM/7ZhXQh4tcH+PY0+TInguZA7+bneOetxxODr+gWSRZ5XOo d3vTcrOZQ2Krhh3j0Zqcip4yNtyTo9+CH2rlMJ1JVss3vGxQcqWRZavT6t2iVE7+6hqI /YmQ2cuXUaATXG41Y6Gkg9RfvkO5IlR1B4mdbMAHhaZMj1NK6R97L2ka2Nrvl4DEG7T4 h9GSuvnmMmfCuf36XoABSuopMNdjtq+ngA5eCQII3OPeGmC42+JtH2HttB7m0u93yyDl 8ZWg== 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=+mfdH0iH0DaLkrWSziKCI0u112NKWqMjP+WeVBtnVk0=; b=Uiv0y2Fo33WazQXi7Tibjn41e4x9ZhxWhGHI24p1UAa+dJTV+1T/BG4XGXMwWbUssM b1z7053veStw5LZjwsgh3PL5C/drHxCgCPuBoBVl6aziEUzLy+W+vqtRC1lrtuBxZmjj 1E1a/TZgmJ+H4Ts4pUSTw4WMDMpYJxgt0QfRPwJqQbWlBd386u+PB594srhaeeC81U0B tOxc5zneY5ZCQsCqE4CLR+aobPdSq3h8ui+Pp43IoIZeT1u2fYsvR+SndWxOddMmlFpT rRGZd6OJRumDm1eeQijoOxaGCZiQYxfwH1mBwGWC6NoP7jcSiCzV7jaA+pavPF0p/Uey 7xuA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=selector1 header.b=fgpTUO7w; spf=pass (google.com: domain of ktkhai@virtuozzo.com designates 104.47.2.104 as permitted sender) smtp.mailfrom=ktkhai@virtuozzo.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=virtuozzo.com Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-db5eur01on0104.outbound.protection.outlook.com. [104.47.2.104]) by mx.google.com with ESMTPS id p3-v6si2718069qkb.265.2018.07.09.01.37.56 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 09 Jul 2018 01:37:56 -0700 (PDT) Received-SPF: pass (google.com: domain of ktkhai@virtuozzo.com designates 104.47.2.104 as permitted sender) client-ip=104.47.2.104; Authentication-Results: mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=selector1 header.b=fgpTUO7w; spf=pass (google.com: domain of ktkhai@virtuozzo.com designates 104.47.2.104 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=+mfdH0iH0DaLkrWSziKCI0u112NKWqMjP+WeVBtnVk0=; b=fgpTUO7w7xsVrAB3tMxRcBXvRInqa3gk5X8/xubv2w3wS5KKhmvIaw4BF739ZFHTQUDtjz+3fNu27qOL6vwz1npQD/3mpF28WOfpQXLUG8EDq9I8LEnc3Daha6c0wbMYzaktyFKd9PN6VPzNQ0XW5itrdQ8TeZlPIxgYcPN/XOc= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=ktkhai@virtuozzo.com; Received: from localhost.localdomain (185.231.240.5) by HE1PR0801MB1337.eurprd08.prod.outlook.com (2603:10a6:3:39::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.930.19; Mon, 9 Jul 2018 08:37:52 +0000 Subject: [PATCH v9 03/17] mm: Assign id to every memcg-aware shrinker 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, akpm@linux-foundation.org, ktkhai@virtuozzo.com Date: Mon, 09 Jul 2018 11:37:44 +0300 Message-ID: <153112546435.4097.10607140323811756557.stgit@localhost.localdomain> In-Reply-To: <153112469064.4097.2581798353485457328.stgit@localhost.localdomain> References: <153112469064.4097.2581798353485457328.stgit@localhost.localdomain> User-Agent: StGit/0.18 MIME-Version: 1.0 X-Originating-IP: [185.231.240.5] X-ClientProxiedBy: HE1PR0301CA0002.eurprd03.prod.outlook.com (2603:10a6:3:76::12) To HE1PR0801MB1337.eurprd08.prod.outlook.com (2603:10a6:3:39::27) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 4836d9b1-73f9-414b-b3c7-08d5e57743bb X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989117)(5600053)(711020)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(2017052603328)(7153060)(7193020); SRVR:HE1PR0801MB1337; X-Microsoft-Exchange-Diagnostics: 1; HE1PR0801MB1337; 3:iFqpcSc6h9awBSoNRhSB6E9YVLf2BZ8aa4+KrF+a+ZNC2N2qJfs3VgqLto+hM6Y0BC6kULmj/pkxkhvF8wRFgF2duzaNx6dOMU0awEub8vPWwUzypzVzZGAkPVnMuDbW7WlCo45if2bQwkrLzqZIJHFOaozvXAxzJ1RyamRkDeQe3dAMI+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UDuyp7x6OXy+UEypUC8OK+1jk9wFt0rpgdcM0E3XGoJkkoTGHEU7//7ae3oADDop6isb0Ntt0gZij/eRUvBqIxi5JEUSVoNuur/PUItMGzn3+Cxe3+nzpPQFLBU9hipKooNva6eaAdfmxABCD8OdzZHqGI9yeZNWOfuPCJze; 4:0y5Yi5X/1wP1h+kta1Oc6XGdspuiP1WFs3iPIjs6Uwc4xPINeaEVDIEfDSzfJxSbLgi2lwarWtuTTyFOJmvvGnhHdQDrymxHqZSsU1kKSFNNUnP4GHRSkJBbAH3bC62ifDe8ob9mT13uEH090wtchQGg6eLVy6GAKmDzdjxeQyumSX2BCki81Zd+0Uz+I0wZxGZLiin7c4FEkTbQwRGHCRkL2JsM3o55TFGkPyjIChp3MIMrauZrZ4KBeibjsJkR3Y4UpbdRUSVTW0x6wgJW+4nd/JwifjbsGoZt8TyLbpY71KCocWZ7I3OQ2KkwJ4aUJqHPcA3efOq4wQO4bVGTo9yI31Zj6HF9MyGF7s9RlBY0fPoXGNjscAYWS+9oeM04 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)(3231311)(944501410)(52105095)(93006095)(93001095)(10201501046)(3002001)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123564045)(20161123562045)(20161123558120)(6072148)(201708071742011)(7699016); SRVR:HE1PR0801MB1337; BCL:0; PCL:0; RULEID:; SRVR:HE1PR0801MB1337; X-Forefront-PRVS: 07283408BE X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(6069001)(346002)(366004)(39840400004)(376002)(136003)(396003)(189003)(199004)(105586002)(50466002)(106356001)(52116002)(478600001)(97736004)(86362001)(16526019)(76176011)(316002)(7696005)(33896004)(186003)(6666003)(26005)(7416002)(103116003)(25786009)(5660300001)(39060400002)(8936002)(53936002)(14444005)(61506002)(68736007)(9686003)(476003)(956004)(11346002)(230700001)(446003)(2486003)(7736002)(3846002)(305945005)(6116002)(58126008)(23676004)(386003)(8676002)(6506007)(47776003)(55016002)(2906002)(81166006)(81156014)(66066001)(486006)(921003)(1121003); DIR:OUT; SFP:1102; SCL:1; SRVR:HE1PR0801MB1337; 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?MTtIRTFQUjA4MDFNQjEzMzc7MjM6SWhsM3UrZFBnMEdJVUZYMHpBYVE5WS9w?= =?utf-8?B?RDFKVXVBL1creEd3YzJCcCs2eXNPY3dacWZkWGpTVWdwdGdJaEQ0cGdtWGZ5?= =?utf-8?B?YVR3V05wMDUvQTRwa3ArSnZGcUJHNS9GeEFacVlVaDV1WUpPSHhvMDQzS3Mr?= =?utf-8?B?dC9MR3B1ckdzUldUTC9QVmU0MDhyMDBzalBoa0NvMjA0MHRjUW1tNzlhZ21Y?= =?utf-8?B?aE5LdTE5QWQ0WDVYNERacjlRc0ZITEFLbHFOTEcwK0RiSGdra3ppTVBLSUlJ?= =?utf-8?B?UEd0dHZ1ZkZ3cEZzcER0YlE2TTlyVXRCd1liV2dFVXU5emgza1JNR3NDVWpZ?= =?utf-8?B?dnRXaVlvUUdsM09OUzNKditQbXByZzBPcWNCQTkwcTdTTm9YS2hDMXNtQ2tH?= =?utf-8?B?SkkvZHNWVDF2MDVrcEtpWkUrUjdYbS8vbmFmTnprRUUxSW9tWUs1b0M3THkr?= =?utf-8?B?TEFmTzB6U2VMcEZjeUdSbkFybjY1aTZLRUR0bjZlbXdZWUlFMkl5TVR2N1Jo?= =?utf-8?B?Z2lHWFkrYzZ0QTV3YStBSDdtUW5LdkdPSXRwSmdVVUtZYzVDVWYvOGdEd1hp?= =?utf-8?B?b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XELgyRszleLg4aSa1uLBPDALymahJMp7gvYDcF08GzcGyCqteiODoXhV01rqxeyU6P2pFdJsgqejCcSp6/6G6o1XJlf5HBreKS2mxBhXZM0n3ME9rpiexNZjBvV0ep5uueij+msnHGAL1zWAIlcx+HZgWmyrRAww==; 5:WJLC0fm8g92dFNitoCSORFZkwDdRcrKfAHQMc48rTFz99JpAoBLqtDWTM++e8/ZY0EDSJv6wUf79ypandToofb8VU+OSkNQ1dXKccvh09N6yMlN2JgSVoeuqAYHnKQp8HDdoW4ZZtLFcbvYoPoCjqlJJ6zbBmWmLz75I/NXEfj8=; 24:lVypnAaKwO017V0Z/TZSkkhLnvED1DroPJ5jP5l3XBaBgOnzJ+zPY8FTzj4g1Kb5vdFdg8ruON7w0QOawl+3P/5tiEOVBmy/oXfss3nJykY= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; HE1PR0801MB1337; 7:f6ynvM7X+E+S+jIg5AdK/LQ2reEylR/DbGFWMUMSo788BhJ39BpObG+D6M+r5GHaJBrQPASyAzl1A/nlT0Xylp1HB4AX5Fm0aYCND60NGmtmW7mZbN0ThNnySBVAT24Jd3TeTghGWLao0OZIUJkTO2qkpGQ6Z7B09L/0QOSkolMwVvvr7tYSEU0+uovFx8BVQo0Qpa/hGk6e48bFOgaUR1kN8hOh7GAS1kQ48teFZub3oIlXSdUPNZ3xGF6VGHgV; 20:2HgVs5eOuF6A7AI42dnvYMzE8ZmjiQshefJ5A9dwvedHD6dF6mpeKMErcVfO7RPFDEayHHcqWDF0sj+Xn+PSANbxDFhIFSB26vSHUSm/p5qkghiVAphi6XdqqOcW3F6Czk9tTSE6lQx45/JK6885KSV9FCLAHfBEk/cVgpO/PpY= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Jul 2018 08:37:52.8817 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4836d9b1-73f9-414b-b3c7-08d5e57743bb X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR0801MB1337 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 Acked-by: Vladimir Davydov Tested-by: Shakeel Butt --- include/linux/shrinker.h | 4 +++ mm/vmscan.c | 63 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 67 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 a00d94530e57..5cb4f779ea4a 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -169,6 +169,50 @@ 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 shrinker_nr_max; + +static int prealloc_memcg_shrinker(struct shrinker *shrinker) +{ + int id, ret = -ENOMEM; + + down_write(&shrinker_rwsem); + /* This may call shrinker, so it must use down_read_trylock() */ + id = idr_alloc(&shrinker_idr, shrinker, 0, 0, GFP_KERNEL); + if (id < 0) + goto unlock; + + if (id >= shrinker_nr_max) + shrinker_nr_max = id + 1; + shrinker->id = id; + ret = 0; +unlock: + up_write(&shrinker_rwsem); + return ret; +} + +static void unregister_memcg_shrinker(struct shrinker *shrinker) +{ + int id = shrinker->id; + + BUG_ON(id < 0); + + down_write(&shrinker_rwsem); + idr_remove(&shrinker_idr, id); + up_write(&shrinker_rwsem); +} +#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) { @@ -313,11 +357,28 @@ 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) { + if (prealloc_memcg_shrinker(shrinker)) + 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->nr_deferred) + return; + + if (shrinker->flags & SHRINKER_MEMCG_AWARE) + unregister_memcg_shrinker(shrinker); + kfree(shrinker->nr_deferred); shrinker->nr_deferred = NULL; } @@ -347,6 +408,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);