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=-10.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING, 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 2730BC4363A for ; Tue, 20 Oct 2020 15:52:13 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 22E7622283 for ; Tue, 20 Oct 2020 15:52:11 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 22E7622283 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 27C3B6B006C; Tue, 20 Oct 2020 11:52:11 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 205FC6B0070; Tue, 20 Oct 2020 11:52:11 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0F5366B0071; Tue, 20 Oct 2020 11:52:11 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0186.hostedemail.com [216.40.44.186]) by kanga.kvack.org (Postfix) with ESMTP id CF7E76B006C for ; Tue, 20 Oct 2020 11:52:10 -0400 (EDT) Received: from smtpin30.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 4800E362B for ; Tue, 20 Oct 2020 15:52:10 +0000 (UTC) X-FDA: 77392745220.30.soda63_190a14127240 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin30.hostedemail.com (Postfix) with ESMTP id 1632F180B3C8B for ; Tue, 20 Oct 2020 15:52:10 +0000 (UTC) X-HE-Tag: soda63_190a14127240 X-Filterd-Recvd-Size: 2746 Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by imf44.hostedemail.com (Postfix) with ESMTP for ; Tue, 20 Oct 2020 15:52:09 +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 2661AAE95; Tue, 20 Oct 2020 15:52:08 +0000 (UTC) To: Christophe Leroy , linux-mm , "linux-kernel@vger.kernel.org" , "linuxppc-dev@lists.ozlabs.org" , "Aneesh Kumar K.V" , Nicholas Piggin , Johannes Weiner References: <31ef1305-1fd4-8159-a2ca-e9968a568ff0@csgroup.eu> From: Vlastimil Babka Subject: Re: mm: Question about the use of 'accessed' flags and pte_young() helper Message-ID: Date: Tue, 20 Oct 2020 17:52:07 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.3.2 MIME-Version: 1.0 In-Reply-To: <31ef1305-1fd4-8159-a2ca-e9968a568ff0@csgroup.eu> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: quoted-printable 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 10/8/20 11:49 AM, Christophe Leroy wrote: > In a 10 years old commit > (https://github.com/linuxppc/linux/commit/d069cb4373fe0d451357c4d376962= 3a7564dfa9f), powerpc 8xx has > made the handling of PTE accessed bit conditional to CONFIG_SWAP. > Since then, this has been extended to some other powerpc variants. >=20 > That commit means that when CONFIG_SWAP is not selected, the accessed b= it is not set by SW TLB miss > handlers, leading to pte_young() returning garbage, or should I say pos= sibly returning false > allthough a page has been accessed since its access flag was reset. >=20 > Looking at various mm/ places, pte_young() is used independent of CONFI= G_SWAP >=20 > Is it still valid the not manage accessed flags when CONFIG_SWAP is not= selected ? AFAIK it's wrong, reclaim needs it to detect accessed pages on inactive l= ist,=20 via page_referenced(), including file pages (page cache) where CONFIG_SWA= P plays=20 no role. Maybe it was different 10 years ago. > If yes, should pte_young() always return true in that case ? It should best work as intended. If not possible, true is maybe better, a= s false=20 will lead to inactive file list thrashing. > While we are at it, I'm wondering whether powerpc should redefine arch_= faults_on_old_pte() > On some variants of powerpc, accessed flag is managed by HW. On others,= it is managed by SW TLB miss > handlers via page fault handling. >=20 > Thanks > Christophe >=20