From patchwork Wed May 9 11:58:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kirill Tkhai X-Patchwork-Id: 10389287 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 7F58960318 for ; Wed, 9 May 2018 11:58:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6D48428C59 for ; Wed, 9 May 2018 11:58:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6128F28EBA; Wed, 9 May 2018 11:58:48 +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 B42DE28C59 for ; Wed, 9 May 2018 11:58:47 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A52576B0508; Wed, 9 May 2018 07:58:46 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id A2A2E6B0509; Wed, 9 May 2018 07:58:46 -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 8F17D6B050A; Wed, 9 May 2018 07:58:46 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pf0-f200.google.com (mail-pf0-f200.google.com [209.85.192.200]) by kanga.kvack.org (Postfix) with ESMTP id 4766C6B0508 for ; Wed, 9 May 2018 07:58:46 -0400 (EDT) Received: by mail-pf0-f200.google.com with SMTP id z5so14537709pfz.6 for ; Wed, 09 May 2018 04:58:46 -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=SL/J3kZJd4MvhsdvB08PgzAZzS2cv/GCkCVunhyRVU8=; b=ZYVnIiJyBgddnKpEZ2gT8K3tQ/DA3Mol8NxYY2u7iWqlSjQU1GOYZD+UQDe+7wCCkV Mxj1Pp8Q43LreTLPGR5xkY61CJ3TX39J9arpc5OHRFpciPcR1w6SS4SWCTRG78l9JQzN 4EZ3FN7/VYltae8Y62eLzhntO7kauQ5Mf9ZIKH21CFTKRtUyFM57fA6uAXVacSBLTTr+ +lRYKYt0QyGXggCSmu8m/YNC4rc8/9vkCfEDhOBP58w12BysHXKfLbF/yRkdqtnf8qcR Ybs/dF/R+IsSeMFkPrCTnnUnwaXPuxXNngoJps93EVBjdSxf5ocPTxElCzKfpegZh846 RzJQ== X-Gm-Message-State: ALQs6tC6BwaOCJjwAl9lm6+dWebgq30NWbismm8TEe0Gc/wwznGworc9 4KA4+QH0rDfSlD4zNuQaZfvVsAazSUx6RIwfGz7hhvrJ8DAyXpRIh1Ls3knXUYnCQH+8+U5TkTm 6/mRyCN9HIKDskEctg8GOOUVfDyONAIkgDN3DTYqPOGyEKSPCxCjVuPslKiURwYugBw== X-Received: by 2002:a17:902:1682:: with SMTP id h2-v6mr45448843plh.127.1525867125961; Wed, 09 May 2018 04:58:45 -0700 (PDT) X-Google-Smtp-Source: AB8JxZofDNQxrsoBViCBch7Ihu+jnm5XDiIdTIZMqT9ph4tIS7AT5lbh+GsEml9sKO9jG20TJsPk X-Received: by 2002:a17:902:1682:: with SMTP id h2-v6mr45448804plh.127.1525867125098; Wed, 09 May 2018 04:58:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525867125; cv=none; d=google.com; s=arc-20160816; b=LPrbRJ3HvqI0whEUkEQYN0qCLWLooqyGq3bq13mkw2qZtPk6KXsI2dBi807o181XfF S44f/VBn9VI0AGE5ltSBv8Lz8F0clrbi94zVWmSOOitC29Sv+McrVIm0lqbxhBL7tx2z OO1JPT9gjL/MpBEemdLc70zbQS6yN0Vs0sTnpoeX8I79q9hISadvEt3zjUV9ohtZMCf4 Yq9mOlHNaNuNTyvvuBZ5xsUzCFK3PhtCXWvzZeiwn7F2VAZbzGsGPwMb6tVUC1/uxTkI 6IYNpt8ix+uQxzT+bxpjUdx++UIwMKCWk8veQ+0EG8rKTJb9hiZTYsZSlc5t1Ps8L2BC V3Ig== 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=SL/J3kZJd4MvhsdvB08PgzAZzS2cv/GCkCVunhyRVU8=; b=zlBpyGzmkOh+JTmmXdwGMUlxNRL2xjjqQz3YYCM+poHBag5SMUFwFNaEI2b99+fI/w GGyydVzGdLH9Jjlrot/Amk8nDrt3fj+CCz2YaqwwVSQJlwiEREJStty11CXu/hzyurgE TrweIpF4tqEXjtOlzaw/CJ0uJmShXrbXWpHHQ8qP4RQskF0qVnzagJ2kAfyT2mNTFKko jgfJRUV5vSc6a7vZlh1bvVkOhyyW+R7sToDyOmdbaEHV2nk9ZNc2gyxp5AFOSbfrskQf pySUsjhk0nC+hSi9RVHfjV3m8FkPz+MO9h2bJZNpWeab9BDVAfFKh4cLO8fZ49UHwuNX ATMg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=selector1 header.b=cgh9KCYP; spf=pass (google.com: domain of ktkhai@virtuozzo.com designates 40.107.3.133 as permitted sender) smtp.mailfrom=ktkhai@virtuozzo.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=virtuozzo.com Received: from EUR03-AM5-obe.outbound.protection.outlook.com (mail-eopbgr30133.outbound.protection.outlook.com. [40.107.3.133]) by mx.google.com with ESMTPS id v40-v6si26769206plg.84.2018.05.09.04.58.44 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 09 May 2018 04:58:45 -0700 (PDT) Received-SPF: pass (google.com: domain of ktkhai@virtuozzo.com designates 40.107.3.133 as permitted sender) client-ip=40.107.3.133; Authentication-Results: mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=selector1 header.b=cgh9KCYP; spf=pass (google.com: domain of ktkhai@virtuozzo.com designates 40.107.3.133 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=SL/J3kZJd4MvhsdvB08PgzAZzS2cv/GCkCVunhyRVU8=; b=cgh9KCYP+MEy8M2UlTlBqAlv1F+kWa9VARoINHGOkooo6JbQmnYM4aDP52oDJGRChswaBuM/oEfW1ZPow9dVRaaqFyzFOt6WYG07dBpL0UnNyHgc2jumgD+4b2pfVT1ykCpswJHheyT77sPAH2vEs5eGfTCCvZMIqruL0bFd0v4= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=ktkhai@virtuozzo.com; Received: from localhost.localdomain (195.214.232.6) 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_CBC_SHA384_P256) id 15.20.735.17; Wed, 9 May 2018 11:58:40 +0000 Subject: [PATCH v4 11/13] mm: Iterate only over charged shrinkers during memcg shrink_slab() 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:58:38 +0300 Message-ID: <152586711800.3048.17462409401469930692.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: HE1P190CA0042.EURP190.PROD.OUTLOOK.COM (2603:10a6:7:52::31) To HE1PR0801MB1337.eurprd08.prod.outlook.com (2603:10a6:3:39::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:HE1PR0801MB1337; X-Microsoft-Exchange-Diagnostics: 1; HE1PR0801MB1337; 3:ZfGFDYCJZafuzXS+OIbaHn6KXUbl0BnZkDBsMjBHeR5OtggnGFZLXEkeRycEmvlFADv+Dp2DVQ3xIkN1QK6AZ8X952KHsNUCtWlyiGyoiMoVZ7O7I+zQ7kC45Ifc0bt4FswWloqsEawKDHUw3af9nWgKEWRZgzH+WoM0p1L6nReHn3XjK01BclUmux6VyzJU889gbkqMtZEOlE8gm+LzhFgi0dkv2MQI1JsLkAdExGU3+3RGXf6z1bdDnFFETK+e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8nOEtvlvJBhOE8iM8cGa/BzvHlX/0NVLHPBnUm1xjUBw56VmCyVHsd3Xxj8OCyh6sEl00/qLseT+kNe2p3hPxOz; 4:jb0ifeGzFBuCLC2xIk49RG64cJMH15o8+cksNIPSkhAh3XV41jIiDhBLPzs3HOc4U9lTDRm78mxkyYPGdIgp0G7oOjxjgzoT2K9quQRVxhqQ5tJMsAsl/NDJipV6Xo7SlVRFZ+Yts2tTyK4TUj6MVfBs/4v9toaR+crpsdafu+KF17bSnfslTtU9bmKwm6LTuP5iV+dYcp6zik678L8QR99cdhf39sJAbgFxBpNzedgUWsRDgC66NrDknV6jbQq3aCT2hVULOkb3Xzt1sxZS2A== 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:HE1PR0801MB1337; BCL:0; PCL:0; RULEID:; SRVR:HE1PR0801MB1337; X-Forefront-PRVS: 0667289FF8 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(6069001)(376002)(366004)(39850400004)(346002)(396003)(39380400002)(199004)(189003)(86362001)(486006)(575784001)(316002)(76176011)(446003)(3846002)(7416002)(2486003)(2906002)(52116002)(23676004)(478600001)(26005)(66066001)(6116002)(7696005)(105586002)(106356001)(7736002)(59450400001)(68736007)(6506007)(386003)(8676002)(25786009)(55236004)(6636002)(39060400002)(47776003)(305945005)(33896004)(61506002)(5660300001)(956004)(81166006)(97736004)(230700001)(53936002)(55016002)(476003)(81156014)(8936002)(58126008)(9686003)(11346002)(186003)(16526019)(103116003)(50466002)(921003)(1121003)(309714004); DIR:OUT; SFP:1102; SCL:1; SRVR:HE1PR0801MB1337; 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?MTtIRTFQUjA4MDFNQjEzMzc7MjM6ZEVxWm41Z2dWOFFUb0gwM2ZrcXFKbXc2?= =?utf-8?B?WTRYalVGb3BKd2Z2NkNjY2VqVStZQXVVekNlU3VpazBvTm1vVlVSV01CclBY?= =?utf-8?B?RllyTzJkQjBkQUZ3OHpaWWZERDNFc0tJRk43bm0zTGhqWVViZFJSMlcxR1RV?= =?utf-8?B?TFd2RmMrc1VZRTRMQnBycW9paEppUGx3d0tJWUV6c3pneFIyOWp1ZVNkdWZu?= =?utf-8?B?eFFLMVp0aWs2SnhvQk56MVdiemU0MkdmejBvMlcvSkV4YWNYR3crQ2lUNzh2?= =?utf-8?B?SHMxaGpUNzVVaEo2Qm50dG8zKzRsek1ONFFUdUFIUUNGdDIzVFg4Q29TbWN6?= =?utf-8?B?TFMvRkFPbmQwdjE3TTBrdGN4eHV2dWVwZGNMQXRUZkIvNkFoc0szTnQyVUFQ?= =?utf-8?B?T1JBQnNYUlQ2YXZCWnhYRzAzd0M4aEYweVV5blc0VU9rNEJpUW5KcktCcnNF?= =?utf-8?B?QXlLRFdqTkloU0oyNkJVVkN2QUQ1cTZHYVUyeTdmS1JSUU5kZUx6M01oSk5M?= =?utf-8?B?NzhNOFVUTWNDZ0J3NW9sWnljamNXTzdQeXI1RmlTLys3bWlnaUxWMVMrSS93?= =?utf-8?B?N1BTUEJpTUdBRkNoS0crWTIrWTFwaWhidmp3bGU4bDQySitJOTFDZHF3V2JN?= =?utf-8?B?R3RzTWUwZWxib0NDbTVvdy9mRDQwT1U1M1hYbXRJWFZhRFJZWnhFeFBZaXNi?= =?utf-8?B?SGQ4aXZVcHhQQmZoNTZkSXM0My8zQk4xbG5YdmRWU3h4aXV6aWxTd2NsQmhZ?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dzwv7puZOdNN/XV170+5msytBOgw6sS7ii/2O2msg7qk0iCOOyTUC0rL6/zsUg=; 24:Q1ZAKUiMJfbBX3zyRA2pBew4B28Zpm5cgYWM1Fjg3QHcZc8RvYw41ncpmp6TSJHOsfKgZJMv4AVFAr5+WzzpOtAgvK9WLqLEucUduk3t0Ps= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; HE1PR0801MB1337; 7:jxhhXl0JhCR7cNne5gbFTQ5TbMtsCgLoOGHEutRT5Ikz6s7amiGsRZelOlkFTSKYW6lSjWWyOFmyhRR8154B//9ndiFoLg3CgnCElagMTrsdf13mf+r29EwlE6Mmzq+w/jX1f4fRP8LhURsd6+tUO27LFLev+98EewY0tYiQZPiiCpYVlab5V8DwmnvnGar3yROD8+obfMCfmg9N0RqgKmCE5/KopcGaJv5EBlCu9+egp4lKZyldvjTd/nSPimH8; 20:LNp1WGpfjJxOm7AxTHWGLwUVaDvRV9ElzD4NmGBz6kNoh8grSujmeCdt5P+PIvfsNwE2XJ/eQ6aME2n3VA/fi2+BYZJc3vLLpP0+463bCp6tsqIlr4dSTJkP/m8MmqUrtVrOOM0Nn+JdCc2Q/sDhmi5zTHPyTv7l4KF1a/OeIgU= X-MS-Office365-Filtering-Correlation-Id: c9d4282d-b5e8-468d-2bb6-08d5b5a43537 X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 May 2018 11:58:40.6583 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c9d4282d-b5e8-468d-2bb6-08d5b5a43537 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 Using the preparations made in previous patches, in case of memcg shrink, we may avoid shrinkers, which are not set in memcg's shrinkers bitmap. To do that, we separate iterations over memcg-aware and !memcg-aware shrinkers, and memcg-aware shrinkers are chosen via for_each_set_bit() from the bitmap. In case of big nodes, having many isolated environments, this gives significant performance growth. See next patches for the details. Note, that the patch does not respect to empty memcg shrinkers, since we never clear the bitmap bits after we set it once. Their shrinkers will be called again, with no shrinked objects as result. This functionality is provided by next patches. Signed-off-by: Kirill Tkhai --- include/linux/memcontrol.h | 1 + mm/vmscan.c | 70 ++++++++++++++++++++++++++++++++++++++------ 2 files changed, 62 insertions(+), 9 deletions(-) diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h index 1fb2f96dc2f6..4548b09e44a7 100644 --- a/include/linux/memcontrol.h +++ b/include/linux/memcontrol.h @@ -756,6 +756,7 @@ void mem_cgroup_split_huge_fixup(struct page *head); #define MEM_CGROUP_ID_MAX 0 struct mem_cgroup; +#define root_mem_cgroup NULL static inline bool mem_cgroup_disabled(void) { diff --git a/mm/vmscan.c b/mm/vmscan.c index d1940244d0bf..648b08621334 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -376,6 +376,7 @@ int prealloc_shrinker(struct shrinker *shrinker) goto free_deferred; } + INIT_LIST_HEAD(&shrinker->list); return 0; free_deferred: @@ -547,6 +548,63 @@ static unsigned long do_shrink_slab(struct shrink_control *shrinkctl, return freed; } +#if defined(CONFIG_MEMCG) && !defined(CONFIG_SLOB) +static unsigned long shrink_slab_memcg(gfp_t gfp_mask, int nid, + struct mem_cgroup *memcg, int priority) +{ + struct memcg_shrinker_map *map; + unsigned long freed = 0; + int ret, i; + + if (!memcg_kmem_enabled() || !mem_cgroup_online(memcg)) + return 0; + + if (!down_read_trylock(&shrinker_rwsem)) + return 0; + + /* + * 1)Caller passes only alive memcg, so map can't be NULL. + * 2)shrinker_rwsem protects from maps expanding. + */ + map = rcu_dereference_protected(MEMCG_SHRINKER_MAP(memcg, nid), true); + BUG_ON(!map); + + for_each_set_bit(i, map->map, memcg_shrinker_nr_max) { + struct shrink_control sc = { + .gfp_mask = gfp_mask, + .nid = nid, + .memcg = memcg, + }; + struct shrinker *shrinker; + + shrinker = idr_find(&shrinker_idr, i); + if (!shrinker) { + clear_bit(i, map->map); + continue; + } + if (list_empty(&shrinker->list)) + continue; + + ret = do_shrink_slab(&sc, shrinker, priority); + freed += ret; + + if (rwsem_is_contended(&shrinker_rwsem)) { + freed = freed ? : 1; + break; + } + } + + up_read(&shrinker_rwsem); + return freed; +} +#else +static unsigned long shrink_slab_memcg(gfp_t gfp_mask, int nid, + struct mem_cgroup *memcg, int priority) +{ + return 0; +} +#endif + /** * shrink_slab - shrink slab caches * @gfp_mask: allocation context @@ -576,8 +634,8 @@ static unsigned long shrink_slab(gfp_t gfp_mask, int nid, struct shrinker *shrinker; unsigned long freed = 0; - if (memcg && (!memcg_kmem_enabled() || !mem_cgroup_online(memcg))) - return 0; + if (memcg && memcg != root_mem_cgroup) + return shrink_slab_memcg(gfp_mask, nid, memcg, priority); if (!down_read_trylock(&shrinker_rwsem)) goto out; @@ -589,13 +647,7 @@ static unsigned long shrink_slab(gfp_t gfp_mask, int nid, .memcg = memcg, }; - /* - * If kernel memory accounting is disabled, we ignore - * SHRINKER_MEMCG_AWARE flag and call all shrinkers - * passing NULL for memcg. - */ - if (memcg_kmem_enabled() && - !!memcg != !!(shrinker->flags & SHRINKER_MEMCG_AWARE)) + if (!!memcg != !!(shrinker->flags & SHRINKER_MEMCG_AWARE)) continue; if (!(shrinker->flags & SHRINKER_NUMA_AWARE))