From mboxrd@z Thu Jan 1 00:00:00 1970 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=-15.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 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 053D0C433FE for ; Wed, 9 Dec 2020 09:18:29 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 9603F23B45 for ; Wed, 9 Dec 2020 09:18:28 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9603F23B45 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id F1C8C6B00A9; Wed, 9 Dec 2020 04:18:25 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id ECCE76B00AC; Wed, 9 Dec 2020 04:18:25 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E092F6B00AD; Wed, 9 Dec 2020 04:18:25 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0124.hostedemail.com [216.40.44.124]) by kanga.kvack.org (Postfix) with ESMTP id CAD396B00A9 for ; Wed, 9 Dec 2020 04:18:25 -0500 (EST) Received: from smtpin21.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 82D5B180AD820 for ; Wed, 9 Dec 2020 09:18:25 +0000 (UTC) X-FDA: 77573192970.21.part99_2404ab9273ee Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin21.hostedemail.com (Postfix) with ESMTP id 5EFC2180442C3 for ; Wed, 9 Dec 2020 09:18:25 +0000 (UTC) X-HE-Tag: part99_2404ab9273ee X-Filterd-Recvd-Size: 2888 Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by imf14.hostedemail.com (Postfix) with ESMTP for ; Wed, 9 Dec 2020 09:18:24 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 9F680AC94; Wed, 9 Dec 2020 09:18:23 +0000 (UTC) Subject: Re: [PATCH] mm: don't SetPageWorkingset unconditionally during swapin To: Yu Zhao , Andrew Morton , Johannes Weiner , Joonsoo Kim Cc: linux-mm@kvack.org References: <20201209012400.1771150-1-yuzhao@google.com> From: Vlastimil Babka Message-ID: <805d0032-4f73-cdb8-758a-1c1c1fb73f4c@suse.cz> Date: Wed, 9 Dec 2020 10:18:22 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.5.1 MIME-Version: 1.0 In-Reply-To: <20201209012400.1771150-1-yuzhao@google.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit 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: On 12/9/20 2:24 AM, Yu Zhao wrote: > We are capable of SetPageWorkingset based on refault distances after > commit aae466b0052e ("mm/swap: implement workingset detection for anonymous LRU") > This is done by workingset_refault(), which is right above the > unconditional SetPageWorkingset deleted by this patch. > > The unconditional SetPageWorkingset miscategorizes pages that are > read ahead or never belonged to the working set (e.g., tmpfs pages > accessed by fd). When those pages are swapped in (after they were > swapped out) for the first time, they skew PSI (when using > async swap). When this happens again, depending on their refault > distances, they might skew workingset_restore_anon counter in > addition to PSI because their shadows say they were part of the > working set. > > Signed-off-by: Yu Zhao Acked-by: Vlastimil Babka Makes sense, especially now that we have anonymous LRU support. The flag setting in this context seems to go back all the way to 1899ad18c607 ("mm: workingset: tell cache transitions from workingset thrashing") where I'm not sure why it was even used on the anonymous page, when workingset was only implemented for the page cache. Maybe Johannes remembers? > --- > mm/swap_state.c | 1 - > 1 file changed, 1 deletion(-) > > diff --git a/mm/swap_state.c b/mm/swap_state.c > index 1a01235156d1..6ecc84448d75 100644 > --- a/mm/swap_state.c > +++ b/mm/swap_state.c > @@ -536,7 +536,6 @@ struct page *__read_swap_cache_async(swp_entry_t entry, gfp_t gfp_mask, > workingset_refault(page, shadow); > > /* Caller will initiate read into locked page */ > - SetPageWorkingset(page); > lru_cache_add(page); > *new_page_allocated = true; > return page; >