Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp4662974pxu; Wed, 21 Oct 2020 01:58:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxPeTswILGgBGFr3rZ4bmLaHjrjfbCuoIE2OXZivp0funBAjYqHR3VEu3r+3UHiFmXA4H91 X-Received: by 2002:a05:6402:10c7:: with SMTP id p7mr2078537edu.34.1603270708075; Wed, 21 Oct 2020 01:58:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603270708; cv=none; d=google.com; s=arc-20160816; b=OirCN9j39HxQ8c1mkQXlff9r+/5X68dvyqjHnk0DYcZEcfymD08Mbr2QVpxN+5Ol6/ jASC0uWsEyIWUBCQeoIfzcm+zFUuPfh6nxQXPaKVk71fbuq7fOsvZzcG8DyI+KG9Jx/h OtYvk37mYR2V0+FIHrExdNMdpIYUWS528+fE0egEozSWIhTPfVVLdOH59Le87JC2lW/C 7O9kw4TwROFZ/6HtpUAkoP5RblYLDuM/nwAzrO2TDkETFyqpaLf1ojvoe45MPYFXXhkG 1b49/jaeCVLwARVZlDX0HXBXL/4m+hSplQ/ZodLq3uDIxbEjDHEUvX0uaWAKluhcboz3 65ig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:subject:from :references:to; bh=kWXUzz/f0kPWxHoRTSDeO8CNPS/DNMoeCGE2WnW6sdc=; b=x3HdZMIXkSnHVOT+NApLtrVha4mjhqoIlQK4RzRcsnGHNBrJ+XjSCWbvR+Kd2Y0uoW 4GVBIHB7VKPwMxpUgHKRSsqHU/m5BYZ4emc9ZFrjmkG9zxDk0Gn8K8AQnPcOcpZS6CG+ h0WKWUOfe0wRHHw+B4UnlcZ4dcRnYAui2elHFdlFV8DNcE5BHH45vzyjlngdPg2BMw+j SH7OGfTD8TkQL2V8utCF90bk8V7HFoXpCJfQZOkKBFIw0kHhzzbyUqUk0NN0HRGlKbuh iiBkPEZa0+vjZIOgv5PoHQKvbKnWQ3fl3M8UfHUFMEdle5lXJkcuuZYuzjezsy4lydnE SkhA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id cy20si944867edb.96.2020.10.21.01.58.05; Wed, 21 Oct 2020 01:58:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2436897AbgJTPwK (ORCPT + 99 others); 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 >