From patchwork Thu May 27 06:21:40 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Muchun Song X-Patchwork-Id: 12283493 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1286DC4707F for ; Thu, 27 May 2021 06:25:54 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id ABE6F6135F for ; Thu, 27 May 2021 06:25:53 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org ABE6F6135F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=bytedance.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 4B5506B0072; Thu, 27 May 2021 02:25:53 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4899F6B0082; Thu, 27 May 2021 02:25:53 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3794B6B0083; Thu, 27 May 2021 02:25:53 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0199.hostedemail.com [216.40.44.199]) by kanga.kvack.org (Postfix) with ESMTP id 0800C6B0072 for ; Thu, 27 May 2021 02:25:52 -0400 (EDT) Received: from smtpin22.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 9D23F8249980 for ; Thu, 27 May 2021 06:25:52 +0000 (UTC) X-FDA: 78186025344.22.5E15BF2 Received: from mail-pl1-f170.google.com (mail-pl1-f170.google.com [209.85.214.170]) by imf15.hostedemail.com (Postfix) with ESMTP id D8DCAA0001D7 for ; Thu, 27 May 2021 06:25:47 +0000 (UTC) Received: by mail-pl1-f170.google.com with SMTP id t21so1834889plo.2 for ; Wed, 26 May 2021 23:25:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=esJzMd1gfpQ9fKrHNcdHQMirHFw6zXQFsOGdVn4/sAs=; b=lg7fglwo870iqNRshvVXpvKjYWsyy0gdHArvvqoq9VYfn+EdTnRqUg7WMOQWjdPQE6 eZ0wlnDPIul1IsIbXIyv9OaDHgh2r7ZAsx0HfZ0dZHWXaBBEp6dr/GLKXlQBU3DmAnSh x6gtjGTnKimDBrG31MHDks0RemPb+3PpCBEbNliGZbN1YUdDLHnfg7cmuwdFyngP2jL5 yoW1mBXFX1bp074oOHquuzkEPGVqzHGbFrw6xJCXt5j+in5tvYnmgPYrfhMtwiR72uix dpN+CB+XL+pdYAsTGIzG8AAhxdlrp9hlpMiombqEn+bdkO7f0lyemvTTnaM9jN/A1vnx d8og== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=esJzMd1gfpQ9fKrHNcdHQMirHFw6zXQFsOGdVn4/sAs=; b=QS7yNOMfS4EN/RrHjhZyZUkU/+LinhEQBQm92GCx+lJJBnFZiWmQGKSePDDPS8QaZy g8TWiOFANl0LLwh4uk5fb+ij7zhcj0dP9Kx2/hTIy0kScG/j1GTcE+HFIG6xVC2StIIn o/47NR0bBMpuOutNMbLvt1V7N+taKTcrzrvJ0hWajdA2j/b3ri3pIi9jdKr732HPw695 3JDQ6Gxfo0VPNUWVlh6L0bliuJJq1WOP3erG4PXcPt8y2mQ/BYUYLz14JOWClMm/4raa TK17ivtaLCQXs130ZT/cihvmtg0AfEue0/K/ZVcsmkAxcDkD7wTxNyiNSbHW8fEopaWg zvew== X-Gm-Message-State: AOAM532krwyp1n7ihTVzKCKLSFFJPO7ahqlkoyYDObm9Tn7COuorLPIS wNuipM5em8/8FIIzR4rz+Aw6zw== X-Google-Smtp-Source: ABdhPJwE3j/uDdrFkGioyn232Py8LrD+rF3I2uZIA4806ZDgCQOieiNs1D8mhZLhedMe5GVStbUYTg== X-Received: by 2002:a17:902:c94a:b029:f4:ad23:7e59 with SMTP id i10-20020a170902c94ab02900f4ad237e59mr1757618pla.73.1622096751538; Wed, 26 May 2021 23:25:51 -0700 (PDT) Received: from localhost.localdomain ([139.177.225.254]) by smtp.gmail.com with ESMTPSA id m5sm882971pgl.75.2021.05.26.23.25.43 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 26 May 2021 23:25:51 -0700 (PDT) From: Muchun Song To: willy@infradead.org, akpm@linux-foundation.org, hannes@cmpxchg.org, mhocko@kernel.org, vdavydov.dev@gmail.com, shakeelb@google.com, guro@fb.com, shy828301@gmail.com, alexs@kernel.org, richard.weiyang@gmail.com, david@fromorbit.com, trond.myklebust@hammerspace.com, anna.schumaker@netapp.com Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-nfs@vger.kernel.org, zhengqi.arch@bytedance.com, duanxiongchun@bytedance.com, fam.zheng@bytedance.com, Muchun Song Subject: [PATCH v2 13/21] mm: workingset: use xas_set_lru() to pass shadow_nodes Date: Thu, 27 May 2021 14:21:40 +0800 Message-Id: <20210527062148.9361-14-songmuchun@bytedance.com> X-Mailer: git-send-email 2.21.0 (Apple Git-122) In-Reply-To: <20210527062148.9361-1-songmuchun@bytedance.com> References: <20210527062148.9361-1-songmuchun@bytedance.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: D8DCAA0001D7 Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=bytedance-com.20150623.gappssmtp.com header.s=20150623 header.b=lg7fglwo; spf=pass (imf15.hostedemail.com: domain of songmuchun@bytedance.com designates 209.85.214.170 as permitted sender) smtp.mailfrom=songmuchun@bytedance.com; dmarc=pass (policy=none) header.from=bytedance.com X-Rspamd-Server: rspam04 X-Stat-Signature: ofa89q4q6aoxiad7nbi47d93buu4iku4 X-HE-Tag: 1622096747-356988 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: The workingset will add the xa_node to shadow_nodes, so we should use xas_set_lru() to pass the list_lru which we want to insert xa_node into to set up the xa_node reclaim context correctly. Signed-off-by: Muchun Song --- include/linux/swap.h | 5 ++++- mm/workingset.c | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/include/linux/swap.h b/include/linux/swap.h index 46d51d058d05..a2e1363b1509 100644 --- a/include/linux/swap.h +++ b/include/linux/swap.h @@ -323,9 +323,12 @@ void workingset_activation(struct page *page); /* Only track the nodes of mappings with shadow entries */ void workingset_update_node(struct xa_node *node); +extern struct list_lru shadow_nodes; #define mapping_set_update(xas, mapping) do { \ - if (!dax_mapping(mapping) && !shmem_mapping(mapping)) \ + if (!dax_mapping(mapping) && !shmem_mapping(mapping)) { \ xas_set_update(xas, workingset_update_node); \ + xas_set_lru(xas, &shadow_nodes); \ + } \ } while (0) /* linux/mm/page_alloc.c */ diff --git a/mm/workingset.c b/mm/workingset.c index 4f7a306ce75a..e50827fc3994 100644 --- a/mm/workingset.c +++ b/mm/workingset.c @@ -426,7 +426,7 @@ void workingset_activation(struct page *page) * point where they would still be useful. */ -static struct list_lru shadow_nodes; +struct list_lru shadow_nodes; void workingset_update_node(struct xa_node *node) {