From patchwork Thu Apr 20 08:45:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "zhaoyang.huang" X-Patchwork-Id: 13218149 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2F0BCC77B72 for ; Thu, 20 Apr 2023 08:47:01 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 942DF900003; Thu, 20 Apr 2023 04:47:00 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 8F2E6900002; Thu, 20 Apr 2023 04:47:00 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7E311900003; Thu, 20 Apr 2023 04:47:00 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 6B9DA900002 for ; Thu, 20 Apr 2023 04:47:00 -0400 (EDT) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 370F6A0189 for ; Thu, 20 Apr 2023 08:47:00 +0000 (UTC) X-FDA: 80701139400.13.4377A68 Received: from SHSQR01.spreadtrum.com (unknown [222.66.158.135]) by imf24.hostedemail.com (Postfix) with ESMTP id BA170180008 for ; Thu, 20 Apr 2023 08:46:57 +0000 (UTC) Authentication-Results: imf24.hostedemail.com; dkim=none; spf=pass (imf24.hostedemail.com: domain of zhaoyang.huang@unisoc.com designates 222.66.158.135 as permitted sender) smtp.mailfrom=zhaoyang.huang@unisoc.com; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1681980418; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding:in-reply-to: references; bh=+MDwxtMbJRcQ0E4E0C5ZkhwvO6WEi1poT68XD47z5bQ=; b=TV189DGMsgVtMPaBoamm/4qjz172KaP3Yf1sVlQ17tZ1sFysTxft93BSmMYbrk0GRRnUMJ a86lryrRs2ZNs12jj/6CoEn50vXThrvBLUFCNXRxaXiKUeliyu6aBBx3LCvjthY6jZwjSI +g8V9uvyTA15whlGJT9t/Y2ume9flz4= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1681980418; a=rsa-sha256; cv=none; b=Tc0kzhWMHAAQhiPkMirWczUyNMLv03zzLlZMwvzLCbkjlj17EbR32sa5rk8MbeRRXQQvjk PbsADWORpNo4e4XMYRoCmTu3r+u2Tjb4GGXApDd6Qteh0aiorE7hmlwaqgTUxguq6hr/gw PM+hrWFYfzQMCtPARj+FyTrUuemPBX8= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=none; spf=pass (imf24.hostedemail.com: domain of zhaoyang.huang@unisoc.com designates 222.66.158.135 as permitted sender) smtp.mailfrom=zhaoyang.huang@unisoc.com; dmarc=none Received: from SHSend.spreadtrum.com (bjmbx01.spreadtrum.com [10.0.64.7]) by SHSQR01.spreadtrum.com with ESMTP id 33K8jJDV065205; Thu, 20 Apr 2023 16:45:19 +0800 (+08) (envelope-from zhaoyang.huang@unisoc.com) Received: from bj03382pcu.spreadtrum.com (10.0.74.65) by BJMBX01.spreadtrum.com (10.0.64.7) with Microsoft SMTP Server (TLS) id 15.0.1497.23; Thu, 20 Apr 2023 16:45:17 +0800 From: "zhaoyang.huang" To: Andrew Morton , Johannes Weiner , , , Zhaoyang Huang , Subject: [Resend PATCH] mm: mark folio as workingset in lru_deactivate_fn Date: Thu, 20 Apr 2023 16:45:04 +0800 Message-ID: <1681980304-11719-1-git-send-email-zhaoyang.huang@unisoc.com> X-Mailer: git-send-email 1.9.1 MIME-Version: 1.0 X-Originating-IP: [10.0.74.65] X-ClientProxiedBy: SHCAS03.spreadtrum.com (10.0.1.207) To BJMBX01.spreadtrum.com (10.0.64.7) X-MAIL: SHSQR01.spreadtrum.com 33K8jJDV065205 X-Rspam-User: X-Rspamd-Queue-Id: BA170180008 X-Rspamd-Server: rspam09 X-Stat-Signature: pqe8kxfoqxd1yrk4kxo8y9tog7f1z75u X-HE-Tag: 1681980417-79437 X-HE-Meta: U2FsdGVkX18qInM4Cvn2O2Y4GH8JGlGJHXRL/o5RXqjo3/vE1k+/fKVaDDxSeptqSpE25s9BzFtISeB2kR3J6S5txDl8LG2p652pNh5D8hzzWcEVAwohqJuB+MQgbNInJzK1uCH5knZQ00DNBFi26OzQqzWNOVCJApDkVGpZmwmmURzPY8D4u+3b9ldgueHqWvG/dLdTwVtiSkuxVzjcryjxDH1bJJ6CyGuwBpd21w5iDqxnwGFA7f1e0t5PEN6z2WJOrPUEz7l7rgriDa/rM6r/uBQvfO41RBTeU3qV8HZ+oLSNyozBDJyseMs05piWX2+nlgth+KP3EB/bB5/BMXtxy/UJxBDFV8qvfERy4JZmL02WG4KfwE0Tsq2G876BD+091I/q/wHVb+tXzpMiypvt4j3h684RI9699xDMrTof4PsoYVPBE2ywH1JF+1FM6XI5y7UN59yGeUTgFbHUmX4ou9kCa6oHxPmJzW1WJxHEgP6n/SXdFy8KX/B0yakki4Kdmp1NfiojLrbT1b24au7iMDOaDZH6kk5m0Mg3JkIk4QE/Pg+cNwHwinDysNg/+1lW4pkwS+4m0jdocKd1PsZp67pMEVnClf3WJDDxZSYksr5W0NNTfheb78NK9jJmb9xf10aGJGmVH61nLtMvQFfgt6DAPzEM1n8loHBnHfoJxdd886LdS07z8+CjnmU0oX8KTEozL1sUCYTdsU94n4hA00L6KjOCARy6wHOQNZfrDLzidtEUC3kfLUQ7pNagHwaGRyeGuhbQ/P6w9ESH405+rybsTv5kVVgCrsqLfLKZHeaKiDuZKRtt4yQXZsCVbR5eV/MdL8F4y5kRfy3OzJA5Y9Xix8dgESBBzFD4mCy6pGtYX0ERSxdx+vuOMmM+REnv1wrAqPHBBNFdw3nVD+IhW08CWGviI0hlmlqqdbHr5RF6LuzpkZJpDxvkxadxDlQVRBOAFqb7U4Uhf5b qsgeWtU9 yApZK0v4N86fb3mc6KijomcOq/KHmgAz10NCddZwWLsxsO1RuWKHU+ZXFsNwtYNUwzmO3SGHZ0nYejlj3z2KABv08AFQhq+AAutbjikLrZ1fGc+nz2zTsAQh35c4awM30sIfOmhKCJKuvfTZ1rxkPX4W/l5lMo6cCOzi78B5UVWBu2ecCi8UT+hebyMEc5nsFUvHNcM24mpr2ltsc2WDFw2hYmi4kTPTTra5iyQ5t9RfMbb5Sts2wxpotTq57kVd4/lp/w+UOCeJ1DsldILgE4OeUaIB19bMagzH7momszoy80bgzEydnebqjEFLvVnBY4cEcLd2YfQALmcvf9DTHgAS7VtttKZ3LKvP/6S1zUFVQtKRvqz/oJEZZxg== 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: From: Zhaoyang Huang The folio will be set as workingset by shrink_active_pages during normal reclaiming. However, it will be escaped from doing so when madvise move it by lru_deactivate__fn, which will affect accuracy of thrashing. Signed-off-by: Zhaoyang Huang --- mm/swap.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mm/swap.c b/mm/swap.c index 70e2063..4d1c14f 100644 --- a/mm/swap.c +++ b/mm/swap.c @@ -603,6 +603,7 @@ static void lru_deactivate_file_fn(struct lruvec *lruvec, struct folio *folio) lruvec_del_folio(lruvec, folio); folio_clear_active(folio); folio_clear_referenced(folio); + folio_set_workingset(folio); if (folio_test_writeback(folio) || folio_test_dirty(folio)) { /* @@ -637,6 +638,7 @@ static void lru_deactivate_fn(struct lruvec *lruvec, struct folio *folio) lruvec_del_folio(lruvec, folio); folio_clear_active(folio); folio_clear_referenced(folio); + folio_set_workingset(folio); lruvec_add_folio(lruvec, folio); __count_vm_events(PGDEACTIVATE, nr_pages);