From patchwork Wed Dec 9 01:24:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yu Zhao X-Patchwork-Id: 11960139 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_ADSP_CUSTOM_MED,DKIM_INVALID,DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, 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 4BAC3C4361B for ; Wed, 9 Dec 2020 01:24:09 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 00810239FD for ; Wed, 9 Dec 2020 01:24:08 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 00810239FD Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 49C536B0075; Tue, 8 Dec 2020 20:24:08 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 44CED6B0078; Tue, 8 Dec 2020 20:24:08 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 315136B007B; Tue, 8 Dec 2020 20:24:08 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0080.hostedemail.com [216.40.44.80]) by kanga.kvack.org (Postfix) with ESMTP id 1ACEB6B0075 for ; Tue, 8 Dec 2020 20:24:08 -0500 (EST) Received: from smtpin12.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id E06CF3620 for ; Wed, 9 Dec 2020 01:24:07 +0000 (UTC) X-FDA: 77571997734.12.river88_260c1cd273eb Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin12.hostedemail.com (Postfix) with ESMTP id C112218012009 for ; Wed, 9 Dec 2020 01:24:07 +0000 (UTC) X-HE-Tag: river88_260c1cd273eb X-Filterd-Recvd-Size: 3986 Received: from mail-yb1-f201.google.com (mail-yb1-f201.google.com [209.85.219.201]) by imf26.hostedemail.com (Postfix) with ESMTP for ; Wed, 9 Dec 2020 01:24:07 +0000 (UTC) Received: by mail-yb1-f201.google.com with SMTP id z1so706327ybg.22 for ; Tue, 08 Dec 2020 17:24:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:date:message-id:mime-version:subject:from:to:cc; bh=RI2fL8hh2720oRpuv1ZcODWSwW9Esa0pSyfJ3/Yu184=; b=XbCpUivTVeIt7G8eNZHNpB9cWKrLWWxsai+0ockuKbLWonicZdWGWQx8JEPmplI2eQ zd7e5j29xpoRvULG1LPmEg9luelhSMeAozFHJ/LKsA220Jqwwa2EPNyF9MPvY8A1ehnA RiV/LcTodBqXnPn0l1nX83bd8A5tPsoC/agfcsmAkfGunuaW916yxAZjoxjwGwM8hFk7 svoRySuXrogw9+jAfY4fXbaAaei1ZJAvRNOtfqQVVB3/0SNj7aJTBzGJvew+pJh+VkBX mOxDUhGNHK3rS+DvnU1NKQBrhLBjLa31qMCAlXUnxvDlD+to4UozX5VOqAfDUSyQt05V HQRQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:message-id:mime-version:subject:from :to:cc; bh=RI2fL8hh2720oRpuv1ZcODWSwW9Esa0pSyfJ3/Yu184=; b=bZ7p67QBilQPnN5/NFlnWFGd87xGBXu3PUiXNAeM3cJgdj9TETKfGAUSKWbFgn1Hqu 6tlDvKRmfrpxyNXi/2ObeRiMim3XCRxVjuSKAZQl9Ep2joBfGck4qNsxeQtSASX3RrBb R+WiEhxLJ7lTHApQqHQfTLlu8qhe/JJD8qz+8uXP1xrZ9Qf+awjUObLEDo2oSFSpwln3 iU9MBQT29gnzNS9OTn1G9Gx1nWqpRavxS/BKwvRdWu9oZ2wTk7RalPtb1EjVbDr+DIGv 45jR8w8ubxyEY8x1mnVgKgmR+LB0Slrrg1B31FcoJPGGG/Lrt5ar9n2PkxYxARte5TwX 4FFA== X-Gm-Message-State: AOAM531g+9fKfv9MSL/CtQV4vNryV055qJSLySL2VtMiuNx7PR8BJ1TM rhxxDpeYD0w7HRxzBgDnIKJjv+lWgPg= X-Google-Smtp-Source: ABdhPJyeFxj5OygKbDQO8cThIehS9Kvt5RwgEGUmBnps+0h2GFTe3P5w+WsrWEdCHgnTg1OWLhfwgTZAK88= X-Received: from yuzhao.bld.corp.google.com ([2620:15c:183:200:7220:84ff:fe09:2d90]) (user=yuzhao job=sendgmr) by 2002:a25:5202:: with SMTP id g2mr236349ybb.311.1607477046537; Tue, 08 Dec 2020 17:24:06 -0800 (PST) Date: Tue, 8 Dec 2020 18:24:00 -0700 Message-Id: <20201209012400.1771150-1-yuzhao@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.29.2.576.ga3fc446d84-goog Subject: [PATCH] mm: don't SetPageWorkingset unconditionally during swapin From: Yu Zhao To: Andrew Morton , Johannes Weiner , Joonsoo Kim Cc: Vlastimil Babka , linux-mm@kvack.org, Yu Zhao 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: 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 Acked-by: Johannes Weiner Acked-by: Joonsoo Kim Acked-by: Michal Hocko --- 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;