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: 85779 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp180140vqo; Thu, 20 Apr 2023 01:56:15 -0700 (PDT) X-Google-Smtp-Source: AKy350YZ3MisRbUqWfCXz5feJ9YgwH7J1HRSrLvrxUZrdnUpoqaPPU6uVfYgvk8XYvDnfNT4mQpA X-Received: by 2002:a05:6a20:3d91:b0:d9:6660:8746 with SMTP id s17-20020a056a203d9100b000d966608746mr1945858pzi.18.1681980974857; Thu, 20 Apr 2023 01:56:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681980974; cv=none; d=google.com; s=arc-20160816; b=XFwNM6aLXqhD+HXVcmY7REOJW1erbwPgyBYqQ+R+3q3rWDn2mrquOxFkmIXaHsjyi6 XtpX7mLjutXDNXehMWUDtH11FJ4mV0fLtaawqB/l2FRSsbIqrIxCG7fwBBEb9B8tgr24 UhY7WgpJuaJpTTcsSFNTlt2oaj+6fXEuXXvgAYi+dYtjyNr+6zNJSwbxXMDuGFEk+Fag +hXJ39/uZB5W0SuFvs6AM+bkS1zuRn0dFfhyyVqIFYixqA4XpkqY45cQ1vI9w6aW+cAs 4lXmAihYt9tQBeDlJHTby6QlXH8hGVUBBMBeRNfG/48x75mjTd2ak5XtSGGRcFPB0ITE KZcA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:to:from; bh=+MDwxtMbJRcQ0E4E0C5ZkhwvO6WEi1poT68XD47z5bQ=; b=bEq82l/Mi2tqak9UQZ1wfgdCEpEvlez9AcVPx/nNDGDbw1omvr9QmuurvvFiw5qnC+ 7ivewrtBejXjfw5Xtb14Sl2jzuEzL5gWC/UKG+x+aL83jM0CsZ3QC+uwUSQdYO5O188e lgbHI8O+VCZUxbW4JfkbAr5eEx78y3uYJetUZHphqSJt0ofrwa75hsNQ3F5ROn/Hx1nv tQnuovRfxCt+FTFIwQTC1IlWlV/UxmdMtQtZuZsFZczPw3wrQHEy0mbLjhoVvop1HntQ 5puCKseTxeLIksx8ZtKjnG9x+mZ6qmTKfg6GwMVz3SXyb6XkXxltmi+qGK2vq96HsXTa VNFg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 19-20020a630a13000000b004fbc2116e0esi1017766pgk.205.2023.04.20.01.56.00; Thu, 20 Apr 2023 01:56:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234500AbjDTIr1 (ORCPT + 99 others); Thu, 20 Apr 2023 04:47:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41416 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234527AbjDTIrI (ORCPT ); Thu, 20 Apr 2023 04:47:08 -0400 Received: from SHSQR01.spreadtrum.com (unknown [222.66.158.135]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 101912D56 for ; Thu, 20 Apr 2023 01:47:04 -0700 (PDT) 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-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1763684882685031384?= X-GMAIL-MSGID: =?utf-8?q?1763684882685031384?= 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);