From patchwork Mon Feb 25 20:16:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Weiner X-Patchwork-Id: 10829101 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 90F89922 for ; Mon, 25 Feb 2019 20:16:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7790B2B03D for ; Mon, 25 Feb 2019 20:16:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 672162B84B; Mon, 25 Feb 2019 20:16:49 +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=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,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 7F0FC2B03D for ; Mon, 25 Feb 2019 20:16:48 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E7BE18E0010; Mon, 25 Feb 2019 15:16:46 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id D66C88E000F; Mon, 25 Feb 2019 15:16:46 -0500 (EST) 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 BE31E8E000E; Mon, 25 Feb 2019 15:16:46 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-yb1-f200.google.com (mail-yb1-f200.google.com [209.85.219.200]) by kanga.kvack.org (Postfix) with ESMTP id 913DE8E000D for ; Mon, 25 Feb 2019 15:16:46 -0500 (EST) Received: by mail-yb1-f200.google.com with SMTP id h7so7064310ybq.18 for ; Mon, 25 Feb 2019 12:16:46 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:dkim-signature:from:to:cc:subject:date :message-id:in-reply-to:references:reply-to:mime-version :content-transfer-encoding; bh=NSVRB4KCxOzLiCcKtVzLdp3bqBiDRMqjw6+T+tZutHo=; b=WI+9Fv62m14v2/0bpOh7WDTjNt03Efg6c77ftf67isoxzsD3vTozWCPZxfLsk+wCy3 5yNQsyg3QH5SBHFfezHQGb0G87CJDnw3MjG4giYYm6B2BZKWBxsOtHD2NUPZwrYsVqW2 Wd23VRQg/CnNEmA4Ngu4L3AOq1AnUsxDNLdIXk3+b5/6Tc0fQeD/vniz/MI5G19gmT9D TMu2afqXg1uKFIRdVTuXu3uS0QudCBm3N7JVOIAZKrN8o9XluO6b20zwhzrexJCuLLRF S2fSSwO0rjIzRfOTqGer8pjUSDqKXyzPNV+Y0t9aaRwFwgPSJwmHkDymuba28+P956lh qHpw== X-Gm-Message-State: AHQUAubrIEZGuscY6dTyxsfsZnZ5qVG+Wv5AHnO8N5VtXu0u92jIcNEO DWnneR68DaXyOXdSWGmSsax8JqTxCx6PogZMNieUgVqrbCAWAwZHadMlsUWoWFyG4y8m+csTC9a J0QZ7HtjscY/JmJjM01tjr9LNtQq7aiEeJUePNGy5myV1z5dFEMERCkdoLg+zXkEpBbCuwfcVuG BeJLAXzr3/gtKgvxNjb9BNhlVQ862jKqLbHCXGbCz56/hIR19C2hfKN4zWXoUSi7A7mb7+wFu5D h+Q/M3inNAKdWJLWCn7lqJFXLQDsxr48Dd+l8ND2qG20MXPaztZFuwm10dqX5iN53H1YEBJar6t Vr5bFu7WdgXqgRSPcgTEqxXmDRrXy6iBLMzXACOEpvJPbWlpt2R/44FyCeXSE0n4yHVy24+NNw7 R X-Received: by 2002:a81:9257:: with SMTP id j84mr15453739ywg.401.1551125806214; Mon, 25 Feb 2019 12:16:46 -0800 (PST) X-Received: by 2002:a81:9257:: with SMTP id j84mr15453690ywg.401.1551125805534; Mon, 25 Feb 2019 12:16:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551125805; cv=none; d=google.com; s=arc-20160816; b=XC00XC44P7aQsy5lk9D68ixvSaGRdwHsdKjUIHSHST5lRCvuvjrcJlMooDhCcdppOC K6cb/UQH8OGRHlyq0esYS4MpQ1SG433ZCHhV4J7kanTGkhbWARWCp4CpeDkNVnqpPSoy Ai96mVgkTSLlAUV3ZHrHJIfjdYUHqW4UzFu430gwIIVRgAiPqBZZyWo3NegvnnjaLSNZ 2UfI/+C2aoCl9wj/C/EObfRKw0JLQvBQr8Vc+2cs6ZB60j4tlg2lR5s0J6cPNZ5JnMsq elIeA6EaYaSJwLbryxYgXZWDL9w71uyJCvExU8Cxd8vnnhw+gaZD6w8SrMiga3LaT/S7 co7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature; bh=NSVRB4KCxOzLiCcKtVzLdp3bqBiDRMqjw6+T+tZutHo=; b=Q+vtekyuYbPPn8cTbNKpnHeIJKOr14aYk9xdhBuqpJhEf7Ox0fpeY2v9e9hKd3Gtx7 pQuqxQU/vz+DiMdIVrG+X30CjgMqa0CR8tkp5C8Xd37oZwmT+G5UuBDk61GyA9b61++N wCfZt5LxPzTCFydolmC3OE1+zYlu+ZcRwr5KeVB7KXD8yIv0dVkau6aaFPq7svfEUojq 9EsGKNSsh+rXYcb0G1WjYIrYVcfrwNjgl+pYUAXv8zGnl4+QAY4JiNg0P9XgK6Sp0FOC mq//P2Sphed716B/MKVVbHdEWNByOXj7H81dCcancWBf7m2KE6YAkG19NG1mo9/7u21L keQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cmpxchg-org.20150623.gappssmtp.com header.s=20150623 header.b="hLC/ybu2"; spf=pass (google.com: domain of hannes@cmpxchg.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=hannes@cmpxchg.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.org Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id n205sor1983750ywb.170.2019.02.25.12.16.43 for (Google Transport Security); Mon, 25 Feb 2019 12:16:43 -0800 (PST) Received-SPF: pass (google.com: domain of hannes@cmpxchg.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@cmpxchg-org.20150623.gappssmtp.com header.s=20150623 header.b="hLC/ybu2"; spf=pass (google.com: domain of hannes@cmpxchg.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=hannes@cmpxchg.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references:reply-to :mime-version:content-transfer-encoding; bh=NSVRB4KCxOzLiCcKtVzLdp3bqBiDRMqjw6+T+tZutHo=; b=hLC/ybu208J5Hr28U656XFMsm9P1dk8LEEsg6XGPhjZA6SfujvqBD8s9vRFAJJDaib 54/ixxnjJVDCavglvjLEZdVhdBRWdDRyhDo4ICJaZkj2zeHdgVHrWeq/l6qxrh8+iFdo U318XvKGX5sshyIAom8DJv/6BYI0LlSERV9YK8SaKkfMthMYXp+zW62i8WYpb41pPE9u OF52KB4e33SQCt3g5H/NVqNI9lg73+aRs22cTGf9t9QaSveeACLYUVU2wEV/5TDOU+4/ MxtaYvcNiFptMo2n6wvPCNOn+OxL6Oig8CUSVE48JrBguUrdrGvxH++xSZTZFsbcaoHb OMEA== X-Google-Smtp-Source: AHgI3IYGY1ofN9SNL0IlNKXLqksZQv6irjIM+ASKc2I45LfowTLRtuta55q6EKDXjoyKLwGbcJg0/Q== X-Received: by 2002:a81:9895:: with SMTP id p143mr15352221ywg.159.1551125803492; Mon, 25 Feb 2019 12:16:43 -0800 (PST) Received: from localhost ([2620:10d:c091:200::2:5fab]) by smtp.gmail.com with ESMTPSA id 207sm1452295yww.22.2019.02.25.12.16.42 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 25 Feb 2019 12:16:42 -0800 (PST) From: Johannes Weiner To: Andrew Morton Cc: Tejun Heo , Roman Gushchin , linux-mm@kvack.org, cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-team@fb.com Subject: [PATCH 1/6] mm: memcontrol: track LRU counts in the vmstats array Date: Mon, 25 Feb 2019 15:16:30 -0500 Message-Id: <20190225201635.4648-2-hannes@cmpxchg.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190225201635.4648-1-hannes@cmpxchg.org> References: <20190225201635.4648-1-hannes@cmpxchg.org> Reply-To: "[PATCH 0/6]"@kvack.org, "mm:memcontrol:clean"@kvack.org, up@kvack.org, the@kvack.org, LRU@kvack.org, counts@kvack.org, tracking@kvack.org MIME-Version: 1.0 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 memcg code currently maintains private per-zone breakdowns of the LRU counters. This is necessary for reclaim decisions which are still zone-based, but there are a variety of users of these counters that only want the aggregate per-lruvec or per-memcg LRU counts, and they need to painfully sum up the zone counters on each request for that. These would be better served using the memcg vmstats arrays, which track VM statistics at the desired scope already. They just don't have the LRU counts right now. So to kick off the conversion, begin tracking LRU counts in those. Signed-off-by: Johannes Weiner --- include/linux/mm_inline.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/mm_inline.h b/include/linux/mm_inline.h index 04ec454d44ce..6f2fef7b0784 100644 --- a/include/linux/mm_inline.h +++ b/include/linux/mm_inline.h @@ -29,7 +29,7 @@ static __always_inline void __update_lru_size(struct lruvec *lruvec, { struct pglist_data *pgdat = lruvec_pgdat(lruvec); - __mod_node_page_state(pgdat, NR_LRU_BASE + lru, nr_pages); + __mod_lruvec_state(lruvec, NR_LRU_BASE + lru, nr_pages); __mod_zone_page_state(&pgdat->node_zones[zid], NR_ZONE_LRU_BASE + lru, nr_pages); } From patchwork Mon Feb 25 20:16:31 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Weiner X-Patchwork-Id: 10829103 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BD73B1515 for ; Mon, 25 Feb 2019 20:16:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AE90E2B03D for ; Mon, 25 Feb 2019 20:16:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A2BAC2B84B; Mon, 25 Feb 2019 20:16:51 +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=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,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 384452B03D for ; Mon, 25 Feb 2019 20:16:51 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 127C58E000D; Mon, 25 Feb 2019 15:16:47 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id E79528E000E; Mon, 25 Feb 2019 15:16:46 -0500 (EST) 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 CC8EB8E000D; Mon, 25 Feb 2019 15:16:46 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-yw1-f70.google.com (mail-yw1-f70.google.com [209.85.161.70]) by kanga.kvack.org (Postfix) with ESMTP id 8EE9A8E000C for ; Mon, 25 Feb 2019 15:16:46 -0500 (EST) Received: by mail-yw1-f70.google.com with SMTP id g123so7035824ywb.20 for ; Mon, 25 Feb 2019 12:16:46 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:dkim-signature:from:to:cc:subject:date :message-id:in-reply-to:references:reply-to:mime-version :content-transfer-encoding; bh=NxReYuZN9DV/fcdnYYWinsazWkVL2jKBNqgEJlRIVkI=; b=Pb5tltlfePEXFfuxTx4kYqitmBto4aV0+OYBXTphaTnsyXU8ASd2yr8Nbtige58CxM aBRSG4B0sZXMugs4mhJTD9bwjpvkI9AF2zmh5vbrHr4dG3cl8PwPDoitDcuJExqUPlyk jIDDDL0BRhbOnTUTYceK/y4yXZFPUWNeHlTZfagUzkvr5TWj42nKSLltf7OqPfXCALxE DHjjb73SzPfpgBh5gfT7UpJxSc4JSWtEPQQ48dltqcKVJ07w9AZXnkQyl0Bn25uUummF mnbk0ty7D6ZFAoYbacpSVnkSJf8ADoaf1GgM39AUjh4w/ONEsRus4+DrIcmedXcLcx4u 2yng== X-Gm-Message-State: AHQUAuY/KQ9gSnS4DcIwcYaGOo1PQFZ3HAiWDoAtAdfJfO7wLoLh/Xdp xUGaQks3p3ymctwW7mVVRfyVRsCk7KHziNuUgXc7IcqjGrZm78mYt0fF6Is0dgMgPwCBzAFcYD5 csLqGngCll8VrKaZTqs0iH7IOX7xBO49fZkuTiLEEv09f0YdtjiaC4FxuBaVP8VORyjdiafp/4N NDXThHaJOEOW4QPTFwICsAnOiXSoVaU3KcCHE8leFxTbqVsQBe01KZdltDqDJH02Wp30q+oPFCk 9aqU0KkmerQHp+c22+HdCrRdpBaKpc0BhJg3TuJjdW31A/1tm4rw9RDXdd2mq+UX2i3mUyhgcU7 /EjwUdVOWKjuaY0vFFsUbIrmWvQnTgG4udYrjJLiagVeBQIo7tlIUUsKyrQH6r9UcT5FdbOxwTG z X-Received: by 2002:a81:a090:: with SMTP id x138mr15621481ywg.239.1551125806329; Mon, 25 Feb 2019 12:16:46 -0800 (PST) X-Received: by 2002:a81:a090:: with SMTP id x138mr15621433ywg.239.1551125805568; Mon, 25 Feb 2019 12:16:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551125805; cv=none; d=google.com; s=arc-20160816; b=DxI4Fu2cNB7YrlNnXXGeLSkVb9ukuMuEl2z7Zs5vA5vx5KyU5xzclmMnCjzXrAI007 1vtKhWd74CT+ZXc3spqgw99c8hlKtEtqh3KMGh7WtqQ1s0/NFU5nUWpWYvlt6i/X+tU0 QvB7jZCzOZ3DoxMRE7pM5RGKEaLR2PDZWir0PaB/vHzE9G3SIuZN/vuvH0ssUbU2JpPP MSluPyodDNJir2vlln+wP769+AY/CVsRJssav3zE10Hsy23c525PggZI3TYQ8DCh7yst PujXxoOssuwQ3cbhmxIcrIbkO2wf60QPnfzAlveMeTOHV2GQZl5IgYupSR7OqxxlNrGo CQ0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature; bh=NxReYuZN9DV/fcdnYYWinsazWkVL2jKBNqgEJlRIVkI=; b=rwmhdTff1I+jtLSbJ6DISP2S6c4qNokQDj7ZPeLFjoUgdbSJfy/51Ki/n2CTKf4wfc EFkhNJWr07VpzX4z4x3NZuqASvsg5mt5XlvKadLFv6QsDMS2rx/QWjIdhfjCk9WhCyfL tLVBdWSQOC5PodeEh44YoiFNOv0Et1naexmANeJLbysJdOGd9mQqQIurG86yX0cu8OlL uLoqnZe7hVICSOXYeu36zYttrYgDcL3piqa/caVRvSBoWlPW2QlE9Hvrw9b6cz6JwbG6 NdtvMPTyGqf/bXazoKvUPLlhcToORczb0sZfIVdiDg5FRAw2XUeXRcdDdWGDzSRZ0Nne bqww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cmpxchg-org.20150623.gappssmtp.com header.s=20150623 header.b=luzQQLfA; spf=pass (google.com: domain of hannes@cmpxchg.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=hannes@cmpxchg.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.org Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id e140sor348331ywe.83.2019.02.25.12.16.45 for (Google Transport Security); Mon, 25 Feb 2019 12:16:45 -0800 (PST) Received-SPF: pass (google.com: domain of hannes@cmpxchg.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@cmpxchg-org.20150623.gappssmtp.com header.s=20150623 header.b=luzQQLfA; spf=pass (google.com: domain of hannes@cmpxchg.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=hannes@cmpxchg.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references:reply-to :mime-version:content-transfer-encoding; bh=NxReYuZN9DV/fcdnYYWinsazWkVL2jKBNqgEJlRIVkI=; b=luzQQLfAlhkMiqxgs7iQVY191jzHqiLCl52U+WHYvTimOvbB2V7MACuC+gbDW528lU DKbiIKcrQtSNptJ9coYPFlIEFS+ssnPkar3GIPNUrQqZCcwC+Ag5WppsLRa96c7oXEhR thV9JSwWuUKRvsRXqKYpLBf5z87mDODHrbJG3/gbDB/4cZpk75LM8wLSYeC74xCHfEV9 c27LRac51nakBosUq8aLjsnRE76h7Zd0qHnOgG5wn1IqKUq/vUs1x7gZ91P1BMzfgQui WVKsGjyCh5wpVn4EAD9dl0k4J5tz77Yr9sNCy2BP2OoRLMKizQ9I6+KdKREyX6ZboJRf fOlQ== X-Google-Smtp-Source: AHgI3Ia4FrSj8aeVvg0ZcVodOSd2IjW8ZYgwMknfHnB4yrtpDrMEUX8nnSPTFdvLVZvj/z2LBP9NpA== X-Received: by 2002:a81:480d:: with SMTP id v13mr15514287ywa.240.1551125805337; Mon, 25 Feb 2019 12:16:45 -0800 (PST) Received: from localhost ([2620:10d:c091:200::2:5fab]) by smtp.gmail.com with ESMTPSA id h131sm3799113ywa.81.2019.02.25.12.16.44 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 25 Feb 2019 12:16:44 -0800 (PST) From: Johannes Weiner To: Andrew Morton Cc: Tejun Heo , Roman Gushchin , linux-mm@kvack.org, cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-team@fb.com Subject: [PATCH 2/6] mm: memcontrol: replace zone summing with lruvec_page_state() Date: Mon, 25 Feb 2019 15:16:31 -0500 Message-Id: <20190225201635.4648-3-hannes@cmpxchg.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190225201635.4648-1-hannes@cmpxchg.org> References: <20190225201635.4648-1-hannes@cmpxchg.org> Reply-To: "[PATCH 0/6]"@kvack.org, "mm:memcontrol:clean"@kvack.org, up@kvack.org, the@kvack.org, LRU@kvack.org, counts@kvack.org, tracking@kvack.org MIME-Version: 1.0 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 Instead of adding up the zone counters, use lruvec_page_state() to get the node state directly. This is a bit cheaper and more stream-lined. Signed-off-by: Johannes Weiner --- include/linux/memcontrol.h | 18 ------------------ mm/memcontrol.c | 2 +- mm/vmscan.c | 2 +- 3 files changed, 2 insertions(+), 20 deletions(-) diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h index 534267947664..5050d281f67d 100644 --- a/include/linux/memcontrol.h +++ b/include/linux/memcontrol.h @@ -517,19 +517,6 @@ void mem_cgroup_update_lru_size(struct lruvec *lruvec, enum lru_list lru, unsigned long mem_cgroup_node_nr_lru_pages(struct mem_cgroup *memcg, int nid, unsigned int lru_mask); -static inline -unsigned long mem_cgroup_get_lru_size(struct lruvec *lruvec, enum lru_list lru) -{ - struct mem_cgroup_per_node *mz; - unsigned long nr_pages = 0; - int zid; - - mz = container_of(lruvec, struct mem_cgroup_per_node, lruvec); - for (zid = 0; zid < MAX_NR_ZONES; zid++) - nr_pages += mz->lru_zone_size[zid][lru]; - return nr_pages; -} - static inline unsigned long mem_cgroup_get_zone_lru_size(struct lruvec *lruvec, enum lru_list lru, int zone_idx) @@ -985,11 +972,6 @@ static inline bool mem_cgroup_online(struct mem_cgroup *memcg) return true; } -static inline unsigned long -mem_cgroup_get_lru_size(struct lruvec *lruvec, enum lru_list lru) -{ - return 0; -} static inline unsigned long mem_cgroup_get_zone_lru_size(struct lruvec *lruvec, enum lru_list lru, int zone_idx) diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 5fc2e1a7d4d2..d85a41cfee60 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -737,7 +737,7 @@ unsigned long mem_cgroup_node_nr_lru_pages(struct mem_cgroup *memcg, for_each_lru(lru) { if (!(BIT(lru) & lru_mask)) continue; - nr += mem_cgroup_get_lru_size(lruvec, lru); + nr += lruvec_page_state(lruvec, NR_LRU_BASE + lru); } return nr; } diff --git a/mm/vmscan.c b/mm/vmscan.c index ac4806f0f332..cdf8d92e6b89 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -346,7 +346,7 @@ unsigned long lruvec_lru_size(struct lruvec *lruvec, enum lru_list lru, int zone int zid; if (!mem_cgroup_disabled()) - lru_size = mem_cgroup_get_lru_size(lruvec, lru); + lru_size = lruvec_page_state(lruvec, NR_LRU_BASE + lru); else lru_size = node_page_state(lruvec_pgdat(lruvec), NR_LRU_BASE + lru); From patchwork Mon Feb 25 20:16:32 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Weiner X-Patchwork-Id: 10829105 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8C301922 for ; Mon, 25 Feb 2019 20:16:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7B4972B03D for ; Mon, 25 Feb 2019 20:16:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6EF5B2B84B; Mon, 25 Feb 2019 20:16:56 +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=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,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 0ACA72B03D for ; Mon, 25 Feb 2019 20:16:56 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7F19E8E000F; Mon, 25 Feb 2019 15:16:48 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 727C38E000C; Mon, 25 Feb 2019 15:16:48 -0500 (EST) 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 5C8888E000F; Mon, 25 Feb 2019 15:16:48 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-yb1-f198.google.com (mail-yb1-f198.google.com [209.85.219.198]) by kanga.kvack.org (Postfix) with ESMTP id 2D4D98E000C for ; Mon, 25 Feb 2019 15:16:48 -0500 (EST) Received: by mail-yb1-f198.google.com with SMTP id 202so6976261ybe.2 for ; Mon, 25 Feb 2019 12:16:48 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:dkim-signature:from:to:cc:subject:date :message-id:in-reply-to:references:reply-to:mime-version :content-transfer-encoding; bh=q68vDKJoy4wkBVCCNbeXOOo5XkzY9NuLFWEJjvpu9MI=; b=eyKMTvSjiNYr/Y9RgZVMgh00eEED93Z9DYpvTUofDk6S+BEdU1xLYTE2lFgjRlk715 04nuAvnyXHLDl9MYWj1DMYI7edpXeHppzGZfPWa5hqyop74XXxEaLlrntg06OND0i3z/ ZFuHkLkejxqvj5fKSoKf3HtPHpanumTbGFn7aOrX+9JsCB63iXNp66wxgH9JNZ/8JqTt oqx3h1YXaHhRbY5KCQCHKP8/Ss4Je6GbSQ+GJYbPCiXAGcJi7S8TIh21Ar+94K2sLzqB KppinZ5TgdAyPdYxNADQJQTmMFtXwdf5gsvldy3/MMMXtxv3b0j3vB3YuRBqC1SKPDAa /ckA== X-Gm-Message-State: AHQUAubNyIBopWlbMD43cP1nr4LmZaZreI7GEUPR3zshFk6A4ghkvCB+ TxIrO5xWmMGyPo/2g8dTtls/EDZYKDlCd7NsxxUbMpIR8i5Ofk7dlIk7qDMgEra2zR+9lat+Lg7 YrwtvRLtUysP67qNIb+jB2ECwzeRHjc4MDEszUC9bz+6ZUUGNRScyjCuEM+qL5BdIwRpmG+FMAy cnsez769yDKTF3Zr4sZuqJ5rdITRv8sp4Cj81YxlTC22NnxQtYjrWYZzpt1X0uVbWl/QAoEl50K E0JWtMrcQ39cZD4CiaEPtrVQjoHG45q9rxbu4+SsMjG+MBJt5qrwlj/mw4+CxAusDBSVwi6Z4dY 3n6/gsomEriKSMQ/Gkm/yuXYZFYphb9k7hBvm1TCKWatltOFq1XtXcOYLHstaUkVpX3WPI0Z3JK f X-Received: by 2002:a5b:2c6:: with SMTP id h6mr14290902ybp.476.1551125807958; Mon, 25 Feb 2019 12:16:47 -0800 (PST) X-Received: by 2002:a5b:2c6:: with SMTP id h6mr14290856ybp.476.1551125807159; Mon, 25 Feb 2019 12:16:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551125807; cv=none; d=google.com; s=arc-20160816; b=LliVNrLHJn3xiYtWq0Mf9yyzrHRjtd4lRdl85mo7XoxFSeDiMFVIZHkJoBbHKgOriU xwE32NvU8BonCXxWIT7U1+LAb5///R7SbDy36a3uWuH5RXrcG/EABESzBYqkxeQHA0TB OoDKXkJLnZ50fQj9xq0o1Lv1bJb/wFeBUIxvc8x3sArW//7/gd6QOtv9sZmR3aav5MOA l59dVS2tH+SAPhDjPm19zMu2F87+NYbu8grM4qVRxQ4rsnKWmvlQAw4thE4BexqAqW5j qAgbkqPiNkAaNv86r845lmqf+oRRT0Iz3a2ORNI41HVyevARJW8jVnIGjrq1olfuva7Y 8KZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature; bh=q68vDKJoy4wkBVCCNbeXOOo5XkzY9NuLFWEJjvpu9MI=; b=hv8pcwJDnzK3iwYqvuBOSEiwehMLppXd3DIJ5BisFQHMm05wL6HTlcRpcyb+HyzBEW 6kdM9TksF6OcKrUGKWwRCOUi9HGImAi/UE8pAj5hlzIf8yGI4rAwA7/OcT5+7VHBTqVY gtTLnCo1biM3s86Y5La2vrneeNCmN4k2SHRvjmwTYqLJE5h1BrKtr/fL7H9RQBX8gPga c+BxppqjDruJ+Fv8NTP9cx4di5Dtbcrql/RQMf1ECs830iMB90H91t62Pce6qbdVHay8 upbck0ckmW+w0YhWG78ioMBLPNBZK3xfXzlO4roCYCU3T2f5eakN5yE0/IhVVRIwS1+s ScFw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cmpxchg-org.20150623.gappssmtp.com header.s=20150623 header.b=LSeURdiK; spf=pass (google.com: domain of hannes@cmpxchg.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=hannes@cmpxchg.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.org Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id o126sor1967803ywd.179.2019.02.25.12.16.47 for (Google Transport Security); Mon, 25 Feb 2019 12:16:47 -0800 (PST) Received-SPF: pass (google.com: domain of hannes@cmpxchg.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@cmpxchg-org.20150623.gappssmtp.com header.s=20150623 header.b=LSeURdiK; spf=pass (google.com: domain of hannes@cmpxchg.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=hannes@cmpxchg.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references:reply-to :mime-version:content-transfer-encoding; bh=q68vDKJoy4wkBVCCNbeXOOo5XkzY9NuLFWEJjvpu9MI=; b=LSeURdiK/5CWWWFp/3/7azLqMNHcbE40aqPO/fF3J/AxPZCZPbNPd2yNz9YNGW9LQp r1bEwX2620t8VCAssnDkeNu05CWPaLjAcMBjPuLvyZQa0Y+sCBhnDM7/d3er0j2fEB8G 3lMSOzrBJjETnIypMBCQ1TmQIluv6lRa9LI74di9YTAdodY5kBsUJ9dT2nv7IRFTd5ql b86bP8deruwQcGDf/ijMpSBtp/C33ZNm4mx8/JjeZ14csnZ3nTpwneoOijefuSUYxoFP wA3gCdexiMvHdVGBLCC8gzYJqVNgluF9Rvx3aOfkfqRUJps5SWyeTFyHX6vHdaFFkXUZ gwSA== X-Google-Smtp-Source: AHgI3Iao/Go5XjNUoA5s8pQCn5DH6YCa97MlrjNtbdAx0SrypGx8YzmFQ3F1KNP8GyTaOgDTdDSZ0w== X-Received: by 2002:a0d:c6c6:: with SMTP id i189mr15451828ywd.12.1551125806966; Mon, 25 Feb 2019 12:16:46 -0800 (PST) Received: from localhost ([2620:10d:c091:200::2:5fab]) by smtp.gmail.com with ESMTPSA id q185sm3524476ywb.15.2019.02.25.12.16.46 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 25 Feb 2019 12:16:46 -0800 (PST) From: Johannes Weiner To: Andrew Morton Cc: Tejun Heo , Roman Gushchin , linux-mm@kvack.org, cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-team@fb.com Subject: [PATCH 3/6] mm: memcontrol: replace node summing with memcg_page_state() Date: Mon, 25 Feb 2019 15:16:32 -0500 Message-Id: <20190225201635.4648-4-hannes@cmpxchg.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190225201635.4648-1-hannes@cmpxchg.org> References: <20190225201635.4648-1-hannes@cmpxchg.org> Reply-To: "[PATCH 0/6]"@kvack.org, "mm:memcontrol:clean"@kvack.org, up@kvack.org, the@kvack.org, LRU@kvack.org, counts@kvack.org, tracking@kvack.org MIME-Version: 1.0 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 Instead of adding up the node counters, use memcg_page_state() to get the memcg state directly. This is a bit cheaper and more stream-lined. Signed-off-by: Johannes Weiner --- mm/memcontrol.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/mm/memcontrol.c b/mm/memcontrol.c index d85a41cfee60..e702b67cde41 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -746,10 +746,13 @@ static unsigned long mem_cgroup_nr_lru_pages(struct mem_cgroup *memcg, unsigned int lru_mask) { unsigned long nr = 0; - int nid; + enum lru_list lru; - for_each_node_state(nid, N_MEMORY) - nr += mem_cgroup_node_nr_lru_pages(memcg, nid, lru_mask); + for_each_lru(lru) { + if (!(BIT(lru) & lru_mask)) + continue; + nr += memcg_page_state(memcg, NR_LRU_BASE + lru); + } return nr; } From patchwork Mon Feb 25 20:16:33 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Weiner X-Patchwork-Id: 10829109 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6BFFA1515 for ; Mon, 25 Feb 2019 20:17:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5CCFC2B03D for ; Mon, 25 Feb 2019 20:17:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 512E02B84B; Mon, 25 Feb 2019 20:17:01 +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=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,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 C47422B03D for ; Mon, 25 Feb 2019 20:17:00 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BC6D98E0011; Mon, 25 Feb 2019 15:16:52 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id AFC438E000C; Mon, 25 Feb 2019 15:16:52 -0500 (EST) 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 8AFCB8E0013; Mon, 25 Feb 2019 15:16:52 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-yw1-f72.google.com (mail-yw1-f72.google.com [209.85.161.72]) by kanga.kvack.org (Postfix) with ESMTP id 49C1F8E0011 for ; Mon, 25 Feb 2019 15:16:52 -0500 (EST) Received: by mail-yw1-f72.google.com with SMTP id r67so7090549ywd.4 for ; Mon, 25 Feb 2019 12:16:52 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:dkim-signature:from:to:cc:subject:date :message-id:in-reply-to:references:reply-to:mime-version :content-transfer-encoding; bh=+fTCozRbLMGgETAnd6XOzTuCoFNGxxYSxApGaKudEvQ=; b=l2JnsU4wfZhGx/VZIsJbUUnCYbKxQBbC5/5oLGTTJml7zLLWG9psquSctp5CbRjGsl 9g2MIbWK5kSWwb/y1NPmxcrRz+gM+lFDOcXQla6mAwJ7FOdhxpkg5mb/jPpT3/ZEbn/Q ZEHn6j0VLJxetxjmO9/davStwI853QhAwaaSSvcJVO6NpprUcGlcuCcS1bN/3qdmv3DZ cuSRueMPzY9ZD6AgSrzSiCJBcLXVCkH1pZZG50rOeylgzIpbP4OXMWz327bmJVM5lU+p HxWAlqb5wtZt9o7MYrvF2Q7mRuXncwZPeEANTEEx8bVvUwyan38TlKJKH2fRMlQZRcPC k/pw== X-Gm-Message-State: AHQUAuYhbcjq+RWwDgAKb8mWSnvkGwicQthWVgBOj+17KuziZS4lQ9sm GURwI4U1awZB3RA/t/IedT4MOc0cEJBaICkvVXBo9woGUsFaZbRwSKbm7cDrhsmi/HUzdYt/q8A fYjiw24A+rEJDPbzHdzw6GTuYaA+P0m/k+hdnEyv4nbyba4jbsoH5FhwV/rcYHWID7+DyLSGV8h mscNgmZDBVqv0w/chvWURIMwic6TGe9sagLzQ6STnSgKaICM9x+qdmcvfDz6UEvgzM8L+2cCa9H 4WpeCshEXS+FeQW3V1kAICALc7hwwZ8Hkzm1cxuqzjW+SCVVcZ4MrNrkWcUo1LpDgegf4ON0sQI x/x7XLpkAEiSYfxP176a6le8E9VfC0u1b425fS2RcBesb9LVQuVKM2h54s4O7nSNd/s45pWn0Qi x X-Received: by 2002:a25:abc2:: with SMTP id v60mr9298162ybi.65.1551125812007; Mon, 25 Feb 2019 12:16:52 -0800 (PST) X-Received: by 2002:a25:abc2:: with SMTP id v60mr9298108ybi.65.1551125811203; Mon, 25 Feb 2019 12:16:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551125811; cv=none; d=google.com; s=arc-20160816; b=mUaZ41CLK4ySGOBHI8g4v5XDyQNw7oRToDJE8RMCcWae7vb/q0u7reAPV/iqY5IQNr kJSRzFJP+p3XSlYiczODBYxWHVpsqsDOHy0ujKme40NjzUlpw5Tm3OmubY/cPVb38aQf PtTY+39ru569bp3q1Amuphzdkl0ILW0YtfCUlyksbEk8n4RQAo47wp/RymioQSiZQn7c yjDmBVx5rWjOqgq6E96ze96x1xTrFbYBNsd1+6Lqsqyx22pgWLPX1Bq9mUOs6uvnzuqF ZMab3E3tWzqe8wY0CbwZHrBSvCM9o8IzsJHaVNawsmQcVmXhNAkbe1wEhmAWbYjMAKVx 8ptQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature; bh=+fTCozRbLMGgETAnd6XOzTuCoFNGxxYSxApGaKudEvQ=; b=op22rMnmMrx7tg5yvH6tMWAnIxGeQIBfqAd3RmGGQItNRvhkS5+qDnk/qn80OsByRY 89hpDcKgUg1sHY3+cDF4RY95i5u60H7As+BZLO6SAU4ZqPN3bBbGRRLGARGKPQUyGDPC rSDykoKVYd7+dnHSKrBKkvsB7CUIazDDOFnpASkRYA08vNx42wWrVHdpFBovhpmTXaX9 K3JxlBZPuOH6qDgnXR/1GUsYom0VNgCVyOIFG/Zwezyf9B07pExw1Tfki/SZCcy89YW7 gvWfzQkR2hNTC+CYvOzDW9V+xLsIQ20L6DcbR8VNS0VO2UaNsj9xgwrXDUh1pJAbn4wG +WLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cmpxchg-org.20150623.gappssmtp.com header.s=20150623 header.b=pR8Us5zo; spf=pass (google.com: domain of hannes@cmpxchg.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=hannes@cmpxchg.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.org Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id e186sor2878218yba.97.2019.02.25.12.16.49 for (Google Transport Security); Mon, 25 Feb 2019 12:16:49 -0800 (PST) Received-SPF: pass (google.com: domain of hannes@cmpxchg.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@cmpxchg-org.20150623.gappssmtp.com header.s=20150623 header.b=pR8Us5zo; spf=pass (google.com: domain of hannes@cmpxchg.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=hannes@cmpxchg.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references:reply-to :mime-version:content-transfer-encoding; bh=+fTCozRbLMGgETAnd6XOzTuCoFNGxxYSxApGaKudEvQ=; b=pR8Us5zofqdHOL4z7jHKcjDL0WMwNUIA+4YsVBz/vOIhQUeoq76MDYAD5oviLzLJfn 2D1C9zAIeLeSEEhP53FwAZHe9NM/Epdv936v7im5qIt1jgE6S+7Px6v1XbNEYtlN89M1 44/2b8uxRICmk8ggo80YoUieuN/doUEheNw2g68ujbcRRM00q42HE8mnuKxJWMIajJAH V82x9OJZZe2kz/yCugc2C3VyZVvcOn7n71J1f+PRkpjX5g8gH2pze5Cp6Pl3mJh1aIfC vcQyVmCUvG+dpoV5lCRUKVlTdWS0my4SAcuGGp+td8VifO8dgLiOgpR4fO62HOkMrV1n ixUQ== X-Google-Smtp-Source: AHgI3IYquf0P7kdz6fMvgtKH/Y6f8yrqS+E09Wo566O2FGLUSSk3jjAv5YLqPHwUAIlmveFazoeurA== X-Received: by 2002:a25:7284:: with SMTP id n126mr16346072ybc.504.1551125808763; Mon, 25 Feb 2019 12:16:48 -0800 (PST) Received: from localhost ([2620:10d:c091:200::2:5fab]) by smtp.gmail.com with ESMTPSA id v4sm3734174ywb.98.2019.02.25.12.16.47 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 25 Feb 2019 12:16:48 -0800 (PST) From: Johannes Weiner To: Andrew Morton Cc: Tejun Heo , Roman Gushchin , linux-mm@kvack.org, cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-team@fb.com Subject: [PATCH 4/6] mm: memcontrol: push down mem_cgroup_node_nr_lru_pages() Date: Mon, 25 Feb 2019 15:16:33 -0500 Message-Id: <20190225201635.4648-5-hannes@cmpxchg.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190225201635.4648-1-hannes@cmpxchg.org> References: <20190225201635.4648-1-hannes@cmpxchg.org> Reply-To: "[PATCH 0/6]"@kvack.org, "mm:memcontrol:clean"@kvack.org, up@kvack.org, the@kvack.org, LRU@kvack.org, counts@kvack.org, tracking@kvack.org MIME-Version: 1.0 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 mem_cgroup_node_nr_lru_pages() is just a convenience wrapper around lruvec_page_state() that takes bitmasks of lru indexes and aggregates the counts for those. Replace callsites where the bitmask is simple enough with direct lruvec_page_state() calls. This removes the last extern user of mem_cgroup_node_nr_lru_pages(), so make that function private again, too. Signed-off-by: Johannes Weiner --- include/linux/memcontrol.h | 10 ---------- mm/memcontrol.c | 10 +++++++--- mm/workingset.c | 5 +++-- 3 files changed, 10 insertions(+), 15 deletions(-) diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h index 5050d281f67d..57029eefd225 100644 --- a/include/linux/memcontrol.h +++ b/include/linux/memcontrol.h @@ -514,9 +514,6 @@ int mem_cgroup_select_victim_node(struct mem_cgroup *memcg); void mem_cgroup_update_lru_size(struct lruvec *lruvec, enum lru_list lru, int zid, int nr_pages); -unsigned long mem_cgroup_node_nr_lru_pages(struct mem_cgroup *memcg, - int nid, unsigned int lru_mask); - static inline unsigned long mem_cgroup_get_zone_lru_size(struct lruvec *lruvec, enum lru_list lru, int zone_idx) @@ -979,13 +976,6 @@ unsigned long mem_cgroup_get_zone_lru_size(struct lruvec *lruvec, return 0; } -static inline unsigned long -mem_cgroup_node_nr_lru_pages(struct mem_cgroup *memcg, - int nid, unsigned int lru_mask) -{ - return 0; -} - static inline unsigned long mem_cgroup_get_max(struct mem_cgroup *memcg) { return 0; diff --git a/mm/memcontrol.c b/mm/memcontrol.c index e702b67cde41..ad6214b3d20b 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -725,7 +725,7 @@ static void mem_cgroup_charge_statistics(struct mem_cgroup *memcg, __this_cpu_add(memcg->vmstats_percpu->nr_page_events, nr_pages); } -unsigned long mem_cgroup_node_nr_lru_pages(struct mem_cgroup *memcg, +static unsigned long mem_cgroup_node_nr_lru_pages(struct mem_cgroup *memcg, int nid, unsigned int lru_mask) { struct lruvec *lruvec = mem_cgroup_lruvec(NODE_DATA(nid), memcg); @@ -1430,11 +1430,15 @@ static bool mem_cgroup_out_of_memory(struct mem_cgroup *memcg, gfp_t gfp_mask, static bool test_mem_cgroup_node_reclaimable(struct mem_cgroup *memcg, int nid, bool noswap) { - if (mem_cgroup_node_nr_lru_pages(memcg, nid, LRU_ALL_FILE)) + struct lruvec *lruvec = mem_cgroup_lruvec(NODE_DATA(nid), memcg); + + if (lruvec_page_state(lruvec, NR_INACTIVE_FILE) || + lruvec_page_state(lruvec, NR_ACTIVE_FILE)) return true; if (noswap || !total_swap_pages) return false; - if (mem_cgroup_node_nr_lru_pages(memcg, nid, LRU_ALL_ANON)) + if (lruvec_page_state(lruvec, NR_INACTIVE_ANON) || + lruvec_page_state(lruvec, NR_ACTIVE_ANON)) return true; return false; diff --git a/mm/workingset.c b/mm/workingset.c index dcb994f2acc2..dbc333a21254 100644 --- a/mm/workingset.c +++ b/mm/workingset.c @@ -427,10 +427,11 @@ static unsigned long count_shadow_nodes(struct shrinker *shrinker, #ifdef CONFIG_MEMCG if (sc->memcg) { struct lruvec *lruvec; + int i; - pages = mem_cgroup_node_nr_lru_pages(sc->memcg, sc->nid, - LRU_ALL); lruvec = mem_cgroup_lruvec(NODE_DATA(sc->nid), sc->memcg); + for (pages = 0, i = 0; i < NR_LRU_LISTS; i++) + pages += lruvec_page_state(lruvec, NR_LRU_BASE + i); pages += lruvec_page_state(lruvec, NR_SLAB_RECLAIMABLE); pages += lruvec_page_state(lruvec, NR_SLAB_UNRECLAIMABLE); } else From patchwork Mon Feb 25 20:16:34 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Weiner X-Patchwork-Id: 10829107 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D204E1515 for ; Mon, 25 Feb 2019 20:16:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C298F2B03D for ; Mon, 25 Feb 2019 20:16:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B6EB32B84B; Mon, 25 Feb 2019 20:16:58 +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=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,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 52C852B03D for ; Mon, 25 Feb 2019 20:16:58 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 72CD88E0012; Mon, 25 Feb 2019 15:16:52 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 6B4D08E000C; Mon, 25 Feb 2019 15:16:52 -0500 (EST) 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 556AD8E0012; Mon, 25 Feb 2019 15:16:52 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-yb1-f198.google.com (mail-yb1-f198.google.com [209.85.219.198]) by kanga.kvack.org (Postfix) with ESMTP id 257488E000C for ; Mon, 25 Feb 2019 15:16:52 -0500 (EST) Received: by mail-yb1-f198.google.com with SMTP id h7so7064481ybq.18 for ; Mon, 25 Feb 2019 12:16:52 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:dkim-signature:from:to:cc:subject:date :message-id:in-reply-to:references:reply-to:mime-version :content-transfer-encoding; bh=xYRD3i2lO0S8FmpT0yhEIbRdeHMhHjlJuWkUHWcpJsw=; b=lymw7eEj/AyqBwmisuAgCFnsvJzAeFs5/0m3jIWXnPatiG5iKuUIuv+2NXEoyXOWn3 zef63s3aGtm2TI1TcLQR4Fz8fcbKRlm0Vh+zY/CheLWkA7s17e5YlnInrXR9LnKZndDv mz03L3UkXzPejsswzWgylhbW67ljXJZkvsduiWgK+pXGFomz1sg1tr2lHPWr7R/bt7b/ AeUF3dH1bCoCAX5W1c97rngoXDRKRhR0ATUjyW1JcgpzBFGMV3dxlKYhpD4D26Usfmtw 2t1DKgN3YLP3W9MjwiM5zZnAsgT3NO/LYK2bJ4LDi2I6Iwe4mkGHpAcc6sSuMP0bjnnv oSFg== X-Gm-Message-State: AHQUAuYZxfTO8q1l+bYAoUlCuk3GwusCA3Q3w5NynU8CNNlphtajyZY1 TNn9MXTDLomlWP94CNiiV/6vVFXwGTIzDx3hMzYD+LsYt+4ad/HkwSByh44j3OSX1h9ZQFMTjg1 QK+ACTgDGLUxreDFf5huQOVmPEutjyD4JMPWxHmpRqX/Ng1Mq78i+ydWsG44TKjMSPv3+ykhoLz IZxfNvnV7PZM9mBLKtagZt7YgVNgsapgDTUnPyjz9A21ddXHHIbdy8wG7ouykyF/ZSgZa9ghLfa ez75k5IN+EjvvyHSlpXZdWYA+Johy1cHMnEB4T3qAU5feBIjiBLOcMBgfs68WX05ckU+C3fhopZ FhpP02F/j6scAHtuhz3/qQ4PSVeBYZSu0bhSWNbzZHSmcEZ7M3NV8vOZygRcvOrgwsW4hLuM8W6 V X-Received: by 2002:a25:84cd:: with SMTP id x13mr2638130ybm.218.1551125811919; Mon, 25 Feb 2019 12:16:51 -0800 (PST) X-Received: by 2002:a25:84cd:: with SMTP id x13mr2638079ybm.218.1551125811202; Mon, 25 Feb 2019 12:16:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551125811; cv=none; d=google.com; s=arc-20160816; b=YT4/7jRajvurcZa8Ce/bd5MC+9sIOZDEoVAjicXbBHlMIppiU5Vid565ePUMRiDUvh Qu7PkVveh3j1CbdbkTJxDzNVWopv5RKvd6OGs3eguxzyhYqBX115uQriuBVl5KSzJzUk xT+zaowHCUm71d4M4EeelWhW9joiKoKiADfTv4GH256bFv8ZtO5M7sO7fyVsp2u8dC0d uafHFxoHUsaH4051167/2lSSV2Ov3cocQnz2YL2omkwx2R+ovB2K97T6orFxnGSH4gL0 ryWeR0i4V0P8L9yjTgHKSNW0TuvVqNPZPRZCRJO5NO4ktjTsSaQ18ygu7/QrHe7xE+TK gk+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature; bh=xYRD3i2lO0S8FmpT0yhEIbRdeHMhHjlJuWkUHWcpJsw=; b=lS1neI+rKeiLksF4l70M1LWq+R9m0Fz/CLlj0p2Gf0uDmj4w5ijLjviPbPx+F8Ayrj iTZSY7xmOYf55JKldH1/hPHB4n8llVKPMTVFu2u6MZEtc0kfT9jyqsJmHPLOjzLwAiQs Cevz0Q7Gdj276+cLUGDVJXvULLVW45up35Iit7y5IoT6OdWYkL2OU5LrlUGbQ+jiZobb 7LEqsP+3nheGyTRcaeFBds9E8C8fpSvID8wgQ92e1KBsu8OLYSUeiny7QyeFZckRUN7p H3+O1Cm0WBrcykv8CVNUA0gheSr8SGGJbbEr5SoUG/VD2Q1XRjOSMcOUofh/WAB/VVmX D/hQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cmpxchg-org.20150623.gappssmtp.com header.s=20150623 header.b=0Qvv+sPu; spf=pass (google.com: domain of hannes@cmpxchg.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=hannes@cmpxchg.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.org Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id u206sor5140355ybb.48.2019.02.25.12.16.50 for (Google Transport Security); Mon, 25 Feb 2019 12:16:50 -0800 (PST) Received-SPF: pass (google.com: domain of hannes@cmpxchg.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@cmpxchg-org.20150623.gappssmtp.com header.s=20150623 header.b=0Qvv+sPu; spf=pass (google.com: domain of hannes@cmpxchg.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=hannes@cmpxchg.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references:reply-to :mime-version:content-transfer-encoding; bh=xYRD3i2lO0S8FmpT0yhEIbRdeHMhHjlJuWkUHWcpJsw=; b=0Qvv+sPuypt43ngbcniPJ2vvh40jSAQI87jwhwkzlPgrQhFS7RhXTd7OWCXq+iXvev Uo6PWeYSxzZJCCuxahigvKNfYRi6jmY04vSJYCHHMWjXSJLS/zZYU8zPAQbfn0vMjuLx lV/P55+xYtaFmT6/4rs/jvCN4waWoiZrFI9Lza8UBLmlRfZZXsPwR6uQ22uzDM6b3kQp DTJVZ69NfJhNXx+tj/PX3rft7V0BMtavC9Jfp4ePMr9fSYvZk1EwDeqdEu0xB7lYQFrV fnArNZfI47SsnWGh76pw/mfo+w6J+RIbhvH6AmvN62vtsUPKDj3DIvefac4ycQi3Bs6w zCFA== X-Google-Smtp-Source: AHgI3IbPw29CG2NUoIo2FNnxPOMDd3lhUuauPMBmLEVmk36pSzm6+slOz2azGHhrwS1+ibAkUopPdw== X-Received: by 2002:a25:35d5:: with SMTP id c204mr16173302yba.325.1551125810575; Mon, 25 Feb 2019 12:16:50 -0800 (PST) Received: from localhost ([2620:10d:c091:200::2:5fab]) by smtp.gmail.com with ESMTPSA id 77sm3611855ywr.19.2019.02.25.12.16.49 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 25 Feb 2019 12:16:49 -0800 (PST) From: Johannes Weiner To: Andrew Morton Cc: Tejun Heo , Roman Gushchin , linux-mm@kvack.org, cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-team@fb.com Subject: [PATCH 5/6] mm: memcontrol: push down mem_cgroup_nr_lru_pages() Date: Mon, 25 Feb 2019 15:16:34 -0500 Message-Id: <20190225201635.4648-6-hannes@cmpxchg.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190225201635.4648-1-hannes@cmpxchg.org> References: <20190225201635.4648-1-hannes@cmpxchg.org> Reply-To: "[PATCH 0/6]"@kvack.org, "mm:memcontrol:clean"@kvack.org, up@kvack.org, the@kvack.org, LRU@kvack.org, counts@kvack.org, tracking@kvack.org MIME-Version: 1.0 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 mem_cgroup_nr_lru_pages() is just a convenience wrapper around memcg_page_state() that takes bitmasks of lru indexes and aggregates the counts for those. Replace callsites where the bitmask is simple enough with direct memcg_page_state() call(s). Signed-off-by: Johannes Weiner --- mm/memcontrol.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/mm/memcontrol.c b/mm/memcontrol.c index ad6214b3d20b..76f599fbbbe8 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -1361,7 +1361,7 @@ void mem_cgroup_print_oom_meminfo(struct mem_cgroup *memcg) for (i = 0; i < NR_LRU_LISTS; i++) pr_cont(" %s:%luKB", mem_cgroup_lru_names[i], - K(mem_cgroup_nr_lru_pages(iter, BIT(i)))); + K(memcg_page_state(iter, NR_LRU_BASE + i))); pr_cont("\n"); } @@ -3016,8 +3016,8 @@ static void accumulate_vmstats(struct mem_cgroup *memcg, ? acc->vmevents_array[i] : i); for (i = 0; i < NR_LRU_LISTS; i++) - acc->lru_pages[i] += - mem_cgroup_nr_lru_pages(mi, BIT(i)); + acc->lru_pages[i] += memcg_page_state(mi, + NR_LRU_BASE + i); } } @@ -3447,7 +3447,8 @@ static int memcg_stat_show(struct seq_file *m, void *v) for (i = 0; i < NR_LRU_LISTS; i++) seq_printf(m, "%s %lu\n", mem_cgroup_lru_names[i], - mem_cgroup_nr_lru_pages(memcg, BIT(i)) * PAGE_SIZE); + memcg_page_state(memcg, NR_LRU_BASE + i) * + PAGE_SIZE); /* Hierarchical information */ memory = memsw = PAGE_COUNTER_MAX; @@ -3937,8 +3938,8 @@ void mem_cgroup_wb_stats(struct bdi_writeback *wb, unsigned long *pfilepages, /* this should eventually include NR_UNSTABLE_NFS */ *pwriteback = memcg_page_state(memcg, NR_WRITEBACK); - *pfilepages = mem_cgroup_nr_lru_pages(memcg, (1 << LRU_INACTIVE_FILE) | - (1 << LRU_ACTIVE_FILE)); + *pfilepages = memcg_page_state(memcg, NR_INACTIVE_FILE) + + memcg_page_state(memcg, NR_ACTIVE_FILE); *pheadroom = PAGE_COUNTER_MAX; while ((parent = parent_mem_cgroup(memcg))) { From patchwork Mon Feb 25 20:16:35 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Weiner X-Patchwork-Id: 10829111 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 11832922 for ; Mon, 25 Feb 2019 20:17:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F40F72B03D for ; Mon, 25 Feb 2019 20:17:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E7D8E2B84B; Mon, 25 Feb 2019 20:17:03 +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=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,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 67C6A2B03D for ; Mon, 25 Feb 2019 20:17:03 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id AD5428E0013; Mon, 25 Feb 2019 15:16:54 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id A101B8E000C; Mon, 25 Feb 2019 15:16:54 -0500 (EST) 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 88B1F8E0013; Mon, 25 Feb 2019 15:16:54 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-yb1-f198.google.com (mail-yb1-f198.google.com [209.85.219.198]) by kanga.kvack.org (Postfix) with ESMTP id 5750F8E000C for ; Mon, 25 Feb 2019 15:16:54 -0500 (EST) Received: by mail-yb1-f198.google.com with SMTP id 67so7492682ybm.23 for ; Mon, 25 Feb 2019 12:16:54 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:dkim-signature:from:to:cc:subject:date :message-id:in-reply-to:references:reply-to:mime-version :content-transfer-encoding; bh=Z2sRN7pljcgc3IEs1HOIZy7cq4U6Vg2axPUdXHMU2lE=; b=m0DBBg9pbuTH4rwOi25ZOe+NZekIIqAQt/ZOxiLfotc4gjlKv9FNQtN13m5SzbuqXH KgCBRhrE7M+xSh2FFm6SC5SPRsXy+tbGT52W2irmJ/U4zLEY71i/6Cbdj2TaTc4DcGae ikPd7Vmc+Gl+QipVMle92M5kK73kBEfv8l6hq7hxDwxbhwp+TNZm7lkqemFSXFEwETem zNPYmWsapwe4fqh7ScUFfKvqEzqIAZm31pC41zd0SN6MgFRwY/XcY+FSo2MYhWpGfI+4 L0stcgN7gkh+NPsOA5EIr3/NpFNlDA0y6v9tbHGl5Cs0POqR/Db6U6R3DiTse1f7OKYV z3vg== X-Gm-Message-State: AHQUAuZ74cyzi5606ulIlIVP69y9e53rjpY4nSWCtSAQ0nLk72htYuMz cGz647wt/4CdTIhlYhsKEFaEi/c1c8rvj3Q3+HoYUcNnHdWaFjU0YpyJhlbyIXQtiMd6CUMchlS +o5MrCBozA8SfkP8WiMiym71vGYFYZfrdwJHhvsL7HQE8clFTDZ24INDErTZYz5SOhCvUaTPmJe uyLcPQJdv7+Ahhln0kCkGVsTAKGO8cO5TubBtFh1DtdbRhp6S6SQasWYSddGI1U0lRP78Ts/i0S PN5pZ5hQvSPDTzDj9TCpA22ZGeX+v7WqAz1VLQrEZt73oDEopAteTn5naGWBmX+N7G04V/3rsOB jf6BHyzF9oI5HE/ZnCsb4NS1Rmhnnp+5m27adk41khyoBx4fWQg2zRraI4KVrRb8OVC4KB+lTUD 0 X-Received: by 2002:a25:2455:: with SMTP id k82mr13815816ybk.268.1551125813565; Mon, 25 Feb 2019 12:16:53 -0800 (PST) X-Received: by 2002:a25:2455:: with SMTP id k82mr13815756ybk.268.1551125812697; Mon, 25 Feb 2019 12:16:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551125812; cv=none; d=google.com; s=arc-20160816; b=XwKYlQQqP1yxpofdq4uIUmvgvnBm/ai5xXRjGB/RQEK2uf02ZBILz6sDPYqS77clZM VBOsoY+OkPNcdmr0GktmdXG4aD8U738EP9YI9AJEkgi5B2ilIZSLB6b28AUzQIIEShbQ UCmEDwYpV6gZUJLINycXoPesXVyTeowRqpLQp39Lm1rsf7kPL4MPnosE2T2GEB/+rv6p RNIAv7qo3BSzPUzZ9Tt7nPvkrGlLFrjVmX0f+KA6OYIoy7tX1MEx+CaqjDQGv+ASBePI D5+7DzpaXRCxEeb7LlJaKGv6sgMbmnzMv5ISLMOVN25w3BD2CwBkq4hs/vBV1A55aGlt /ZLg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature; bh=Z2sRN7pljcgc3IEs1HOIZy7cq4U6Vg2axPUdXHMU2lE=; b=tuskSmGjG290f01v3aKnZQnRSdaHBZ1C7a8h5qiPJ1U9q6YkwdPF+WubZgDAmywNyd jhjGUJ4NwwQe2NTUZ9QjAMl9tCoylx8i8eahA+elJLfATueateVCcKXbsEaHqRv5N7XZ UdxEdXgRaopHy4RMgGfW/J2gZKuOK0NbBz3qjAg/umF8Fbl8og67lSlRc7F1btrb8kyF MR9C0w0SRdqPH8ZX3afLqgg+LUI5d+PyirY3OQWFf8JHOxSpwx/z6DCSO4b6O2sw5oba zd67fl9xaBdMnsrC0xu8FflnkiH9gCwTqdVwdniafeGujD34Albs5d7wi3m0RB0w01kL 9A+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cmpxchg-org.20150623.gappssmtp.com header.s=20150623 header.b=1+FrSkex; spf=pass (google.com: domain of hannes@cmpxchg.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=hannes@cmpxchg.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.org Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id 62sor2289184ybf.91.2019.02.25.12.16.52 for (Google Transport Security); Mon, 25 Feb 2019 12:16:52 -0800 (PST) Received-SPF: pass (google.com: domain of hannes@cmpxchg.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@cmpxchg-org.20150623.gappssmtp.com header.s=20150623 header.b=1+FrSkex; spf=pass (google.com: domain of hannes@cmpxchg.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=hannes@cmpxchg.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references:reply-to :mime-version:content-transfer-encoding; bh=Z2sRN7pljcgc3IEs1HOIZy7cq4U6Vg2axPUdXHMU2lE=; b=1+FrSkexTFwKLt3ILN53KvvzB87QgBFIYMGtbBrfjQ/ipShMywFpPzWjN9kgHla69K s+Xaxg36MRA0UddoCVd0M7VsdkWbkeY64kdAyWFAoRn+VbhG3UgwV//T/RYHyiPvodDd QI+hSHfWdEeR9iMTEbMPTzGT7PBdYRhFiuy1hWKWEoscR3EVsMO4Xe65dTWVJMRC9XDh 42OP6nF7O5K04TOClaqE/ZBq0QaulYAQ6YYIXQf/FJ6biVib8KYdBW+SEXI4uUW4iUS0 gVvCAwC3Iv5jvs60VbFBJm5NY3Kd+mm2wh45UAhsyS1weGKcYGgsltyNo27vdHSNUS4T brbA== X-Google-Smtp-Source: AHgI3IbV+Q6pr1OqJoRoDUVdDxORC2SryT/jNlKyj0mobroXn+6xFo8QtZnW4OtS933Nd0SoJfsj0Q== X-Received: by 2002:a25:cb54:: with SMTP id b81mr15489528ybg.520.1551125812493; Mon, 25 Feb 2019 12:16:52 -0800 (PST) Received: from localhost ([2620:10d:c091:200::2:5fab]) by smtp.gmail.com with ESMTPSA id k184sm1010344ywa.85.2019.02.25.12.16.51 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 25 Feb 2019 12:16:51 -0800 (PST) From: Johannes Weiner To: Andrew Morton Cc: Tejun Heo , Roman Gushchin , linux-mm@kvack.org, cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-team@fb.com Subject: [PATCH 6/6] mm: memcontrol: quarantine the mem_cgroup_[node_]nr_lru_pages() API Date: Mon, 25 Feb 2019 15:16:35 -0500 Message-Id: <20190225201635.4648-7-hannes@cmpxchg.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190225201635.4648-1-hannes@cmpxchg.org> References: <20190225201635.4648-1-hannes@cmpxchg.org> Reply-To: "[PATCH 0/6]"@kvack.org, "mm:memcontrol:clean"@kvack.org, up@kvack.org, the@kvack.org, LRU@kvack.org, counts@kvack.org, tracking@kvack.org MIME-Version: 1.0 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 Only memcg_numa_stat_show() uses those wrappers and the lru bitmasks, group them together. Signed-off-by: Johannes Weiner --- include/linux/mmzone.h | 5 ---- mm/memcontrol.c | 67 +++++++++++++++++++++++------------------- 2 files changed, 36 insertions(+), 36 deletions(-) diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h index 2fd4247262e9..4f92d32c26a7 100644 --- a/include/linux/mmzone.h +++ b/include/linux/mmzone.h @@ -305,11 +305,6 @@ struct lruvec { #endif }; -/* Mask used at gathering information at once (see memcontrol.c) */ -#define LRU_ALL_FILE (BIT(LRU_INACTIVE_FILE) | BIT(LRU_ACTIVE_FILE)) -#define LRU_ALL_ANON (BIT(LRU_INACTIVE_ANON) | BIT(LRU_ACTIVE_ANON)) -#define LRU_ALL ((1 << NR_LRU_LISTS) - 1) - /* Isolate unmapped file */ #define ISOLATE_UNMAPPED ((__force isolate_mode_t)0x2) /* Isolate for asynchronous migration */ diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 76f599fbbbe8..84243831b738 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -725,37 +725,6 @@ static void mem_cgroup_charge_statistics(struct mem_cgroup *memcg, __this_cpu_add(memcg->vmstats_percpu->nr_page_events, nr_pages); } -static unsigned long mem_cgroup_node_nr_lru_pages(struct mem_cgroup *memcg, - int nid, unsigned int lru_mask) -{ - struct lruvec *lruvec = mem_cgroup_lruvec(NODE_DATA(nid), memcg); - unsigned long nr = 0; - enum lru_list lru; - - VM_BUG_ON((unsigned)nid >= nr_node_ids); - - for_each_lru(lru) { - if (!(BIT(lru) & lru_mask)) - continue; - nr += lruvec_page_state(lruvec, NR_LRU_BASE + lru); - } - return nr; -} - -static unsigned long mem_cgroup_nr_lru_pages(struct mem_cgroup *memcg, - unsigned int lru_mask) -{ - unsigned long nr = 0; - enum lru_list lru; - - for_each_lru(lru) { - if (!(BIT(lru) & lru_mask)) - continue; - nr += memcg_page_state(memcg, NR_LRU_BASE + lru); - } - return nr; -} - static bool mem_cgroup_event_ratelimit(struct mem_cgroup *memcg, enum mem_cgroup_events_target target) { @@ -3357,6 +3326,42 @@ static int mem_cgroup_move_charge_write(struct cgroup_subsys_state *css, #endif #ifdef CONFIG_NUMA + +#define LRU_ALL_FILE (BIT(LRU_INACTIVE_FILE) | BIT(LRU_ACTIVE_FILE)) +#define LRU_ALL_ANON (BIT(LRU_INACTIVE_ANON) | BIT(LRU_ACTIVE_ANON)) +#define LRU_ALL ((1 << NR_LRU_LISTS) - 1) + +static unsigned long mem_cgroup_node_nr_lru_pages(struct mem_cgroup *memcg, + int nid, unsigned int lru_mask) +{ + struct lruvec *lruvec = mem_cgroup_lruvec(NODE_DATA(nid), memcg); + unsigned long nr = 0; + enum lru_list lru; + + VM_BUG_ON((unsigned)nid >= nr_node_ids); + + for_each_lru(lru) { + if (!(BIT(lru) & lru_mask)) + continue; + nr += lruvec_page_state(lruvec, NR_LRU_BASE + lru); + } + return nr; +} + +static unsigned long mem_cgroup_nr_lru_pages(struct mem_cgroup *memcg, + unsigned int lru_mask) +{ + unsigned long nr = 0; + enum lru_list lru; + + for_each_lru(lru) { + if (!(BIT(lru) & lru_mask)) + continue; + nr += memcg_page_state(memcg, NR_LRU_BASE + lru); + } + return nr; +} + static int memcg_numa_stat_show(struct seq_file *m, void *v) { struct numa_stat {