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 DE36AC388F2 for ; Tue, 20 Oct 2020 15:52:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 937D322244 for ; Tue, 20 Oct 2020 15:52:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2436901AbgJTPwK (ORCPT ); Tue, 20 Oct 2020 11:52:10 -0400 Received: from mx2.suse.de ([195.135.220.15]:50760 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2436797AbgJTPwK (ORCPT ); Tue, 20 Oct 2020 11:52:10 -0400 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: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10/8/20 11:49 AM, Christophe Leroy wrote: > In a 10 years old commit > (https://github.com/linuxppc/linux/commit/d069cb4373fe0d451357c4d3769623a7564dfa9f), 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. > > That commit means that when CONFIG_SWAP is not selected, the accessed bit is not set by SW TLB miss > handlers, leading to pte_young() returning garbage, or should I say possibly returning false > allthough a page has been accessed since its access flag was reset. > > Looking at various mm/ places, pte_young() is used independent of CONFIG_SWAP > > 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 list, via page_referenced(), including file pages (page cache) where CONFIG_SWAP plays 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, as false 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. > > Thanks > Christophe >