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=-8.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING,SPF_HELO_NONE,SPF_PASS 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 9710FC4363A for ; Tue, 20 Oct 2020 18:35:37 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id AAEA62222C for ; Tue, 20 Oct 2020 18:35:36 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=cmpxchg-org.20150623.gappssmtp.com header.i=@cmpxchg-org.20150623.gappssmtp.com header.b="eDpMzgLF" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org AAEA62222C Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=cmpxchg.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 9CDDD6B005C; Tue, 20 Oct 2020 14:35:35 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 97FFA6B0062; Tue, 20 Oct 2020 14:35:35 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 845146B0068; Tue, 20 Oct 2020 14:35:35 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0141.hostedemail.com [216.40.44.141]) by kanga.kvack.org (Postfix) with ESMTP id 5846E6B005C for ; Tue, 20 Oct 2020 14:35:35 -0400 (EDT) Received: from smtpin23.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id DAC131EE6 for ; Tue, 20 Oct 2020 18:35:34 +0000 (UTC) X-FDA: 77393156988.23.hen33_0917c4627241 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin23.hostedemail.com (Postfix) with ESMTP id B0C9E37604 for ; Tue, 20 Oct 2020 18:35:34 +0000 (UTC) X-HE-Tag: hen33_0917c4627241 X-Filterd-Recvd-Size: 4793 Received: from mail-qk1-f194.google.com (mail-qk1-f194.google.com [209.85.222.194]) by imf13.hostedemail.com (Postfix) with ESMTP for ; Tue, 20 Oct 2020 18:35:33 +0000 (UTC) Received: by mail-qk1-f194.google.com with SMTP id r7so2535735qkf.3 for ; Tue, 20 Oct 2020 11:35:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=3bEaFKRFPS/Sh2t/CI7BcAkihd22K7XwWCcLf9zY4qI=; b=eDpMzgLFh+ac8jAdLmXWxs6dOFK/N7u2zhExMvQXU8gLIswGz9dNocWqqJLN/Xmuyt rBZ11B5sKUn96yasph0hl8x+8p+BefVuTBQ57aVaVezZHGTE+dm7xTQUyZgeXJkWn5W+ oERWzaHuOUxRgFPRQORIMQtYcxgIHrWVgfWZux9HU6I7iOtcWighiB11uEEK5eshXa4E /Kbn72MSSNUyOKG4Q+P0k7AMskR5VssEg83c6RQlKEjv4LmdJawNB7uv3SRRo07tmzSY 81pzjCbWB2Jcp/mOXq+/LutPBIhoueU67Qr4WAOrQCbjpgCIbW+OKz5ZPM9mgII8Cjd2 5CHA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=3bEaFKRFPS/Sh2t/CI7BcAkihd22K7XwWCcLf9zY4qI=; b=W0PCIqcIYvmKFThCaICup2jR9qsJc8Sycs50K1Q77d23a6myrynKYq3znqpBpxnRLV xD6uFbx5ZBpmVXbQNiEeRBEQvLmvPAd06dk4hyI9yb5vDu4SJNmrDGLu09obbuzv40fy 53zcRIttZakF5XI3f9wHNkfrHWM1PkOH6vZGxHz/9Te0VnulKEK/ChlogeBoeVFpxVL7 CyBWuXN6DAdRZjQMS2ijKyAMEq858dJWOR2s0aM0sA3QRoo8aMyo4V4QuTYuJy5UOKHj XZ7ztl16TEF/nvQduPORFxiabIquKm9UsGLynDT1ejcxTV03T1+ILV0oSOSoNx+JRmMr 0puA== X-Gm-Message-State: AOAM531i9h+eaYXKuIBlLFN2cCui8nCkHNdScPzbp7hwOVHDyAPsWGhf 2GHyoKyJJFHziGds3UWWAQt/Dg== X-Google-Smtp-Source: ABdhPJx8oRW/tNaZSiG9aS3bionlit1W0IoCBu7VK3t7uOuxJeysus0w6e9BOQuYqJS0NUhYqBefDg== X-Received: by 2002:a37:a5cd:: with SMTP id o196mr3952603qke.374.1603218933224; Tue, 20 Oct 2020 11:35:33 -0700 (PDT) Received: from localhost ([2620:10d:c091:480::1:c52c]) by smtp.gmail.com with ESMTPSA id o2sm1151174qkm.96.2020.10.20.11.35.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Oct 2020 11:35:32 -0700 (PDT) Date: Tue, 20 Oct 2020 14:33:55 -0400 From: Johannes Weiner To: Vlastimil Babka Cc: Christophe Leroy , linux-mm , "linux-kernel@vger.kernel.org" , "linuxppc-dev@lists.ozlabs.org" , "Aneesh Kumar K.V" , Nicholas Piggin Subject: Re: mm: Question about the use of 'accessed' flags and pte_young() helper Message-ID: <20201020183355.GB397401@cmpxchg.org> References: <31ef1305-1fd4-8159-a2ca-e9968a568ff0@csgroup.eu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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 Tue, Oct 20, 2020 at 05:52:07PM +0200, Vlastimil Babka wrote: > 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. Yes, we require this bit for properly aging mmapped file pages. The underlying assumption in the referenced commit is incorrect. > > 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. An unconditional true will cause mmapped file pages to be permanently mlocked / unevictable. Either way will break some workloads. The only good answer is the truth :-)