Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp8499561rwb; Tue, 13 Dec 2022 07:08:35 -0800 (PST) X-Google-Smtp-Source: AA0mqf4B8YvBmDtWjY6PWKKrfeUs1P+4P2FkEn2mzmzV14j7LJV6A2hQE83YlyWNC9cIPhwY1Ne6 X-Received: by 2002:a05:6402:3589:b0:46b:59ee:e1d7 with SMTP id y9-20020a056402358900b0046b59eee1d7mr21234024edc.26.1670944115620; Tue, 13 Dec 2022 07:08:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670944115; cv=none; d=google.com; s=arc-20160816; b=vyyth0qb/yJJm7ceWN5kzhlBCKEf171nsDIfMWW2pBtYngIL6EaxqR+7smbddCWiiE D49oH5qqTx1/ycM5sDHJcYWbtuz2YCUTL6hdB+v53xWTey4ZDRnLDGNohkyReb1EAxnw BPrhvJrdoezPuipqawkiNxf0sIirXuQJC8vpR6nD1sGWuaIWImWQoj4SiBKCI4vVngxF h7+tcBvnamyD+uUDijI/dHPBHzui/aWpf0gJUfXjitn1X1ZgyGY1g1FLv4XqcK2wDpjh Cuc/dKvuciDmAozs7ehbYk7jCHd1LuWqG/furLi7Dah9knq+lEOAbz6GU+XlY3LldOns ts7A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=FQag/jd2GO3yImxnyVKI+1I/10Zv1F9ZtlVjYTPl/hk=; b=rbi9nlMxUwMaMK9yipDfCuW1I1GjPbwfFtpvsQZf5PIc/KsqCafohHPak0CJaZShMT pGmR7iUmyqdi1ScV8v2F8OMf+AFaFo50v9vIUXJPmz3KdaK3QpZYgvM28Wp8dXk079GS aRGCjjhuoOjCUolcWtwsgnFtgT95rj8ip9kjddp9tMryPptXYPWbfMAd6fhSNzaZ1YgC FH6k5kksHIDEuAvJfo7umRwc6QaVDtw6xzAHM16gpIubUajEvcbaM1VdQ85G/XaJW6Ux JzYkvtI4lxYMs5vzRkFKECO9i1Sn7V6PBbEygbet90KLJne5dMpSaOQHeN+ja3OIuL+m WaZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=LvNd3B7Y; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w9-20020a056402128900b0046bd9b65cd9si9027975edv.242.2022.12.13.07.08.15; Tue, 13 Dec 2022 07:08:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=LvNd3B7Y; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235982AbiLMOku (ORCPT + 72 others); Tue, 13 Dec 2022 09:40:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58400 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235961AbiLMOkt (ORCPT ); Tue, 13 Dec 2022 09:40:49 -0500 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 079531E717 for ; Tue, 13 Dec 2022 06:40:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=FQag/jd2GO3yImxnyVKI+1I/10Zv1F9ZtlVjYTPl/hk=; b=LvNd3B7Y+1FKup7/J0jsz0gQCT vtacOOldquFFwwc67FE95SWaH6CgmDTgn8wiVwoEcrY1z9awxnM1z3DgeyrEpiXSqn2A0FzhiHY2j EB3U3lxlZvaKUqN3N5kxTFPlwcBwfOZQe1k1s3rQrAVvvq4PLvE+EBMyFklsvBSEZp1uRkl+6ZXnk ftW88Gg2M6sI99+G0W3E4PN/BOOilZfgiicCE4ozaAqmIQ3KoBSeEtLHC0+7UewnE8sDXqJBcp/Kl 1vu7JdoPJwVWQqEbyVVmCQXd5bMNYI0byAVfuWOM693g2s+k8nYtZQ+ZRHpOW7OHbLSu4nua01UiN 0msfGlxg==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1p56SX-00CJ9w-UA; Tue, 13 Dec 2022 14:40:42 +0000 Date: Tue, 13 Dec 2022 14:40:41 +0000 From: Matthew Wilcox To: Kefeng Wang Cc: Andrew Morton , David Hildenbrand , Oscar Salvador , SeongJae Park , linux-mm@kvack.org, linux-kernel@vger.kernel.org, damon@lists.linux.dev, vishal.moola@gmail.com Subject: Re: [PATCH -next 4/8] mm: damon: add temporary damon_get_folio() Message-ID: References: <20221213092735.187924-1-wangkefeng.wang@huawei.com> <20221213092735.187924-5-wangkefeng.wang@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221213092735.187924-5-wangkefeng.wang@huawei.com> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Dec 13, 2022 at 05:27:31PM +0800, Kefeng Wang wrote: > -struct page *damon_get_page(unsigned long pfn) > +struct folio *damon_get_folio(unsigned long pfn) > { > - struct page *page = pfn_to_online_page(pfn); > + struct folio *folio = pfn_to_online_folio(pfn); > > - if (!page || !PageLRU(page) || !get_page_unless_zero(page)) > + if (!folio || !folio_test_lru(folio) || !folio_try_get(folio)) > return NULL; Well, this is awkward. I asked Vishal to think about exactly this problem and we were going to talk about it after we're both back from vacation in January. But I guess we're going to do this in public instead ... Specifically, what should the semantics be for a putative damon_get_folio() when it encounters a tail page? Should it return the containing folio, or should it return NULL? And if the semantics change here to return the containing folio, what adjustments need to be made to the callers?