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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0B023C4332F for ; Sat, 11 Nov 2023 10:57:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230428AbjKKK5d (ORCPT ); Sat, 11 Nov 2023 05:57:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59590 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230403AbjKKK5c (ORCPT ); Sat, 11 Nov 2023 05:57:32 -0500 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BF8B53AA8 for ; Sat, 11 Nov 2023 02:57:28 -0800 (PST) Received: from dggpemm100001.china.huawei.com (unknown [172.30.72.56]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4SSCGL47mtzPng8; Sat, 11 Nov 2023 18:53:14 +0800 (CST) Received: from [10.174.177.243] (10.174.177.243) by dggpemm100001.china.huawei.com (7.185.36.93) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Sat, 11 Nov 2023 18:57:24 +0800 Message-ID: Date: Sat, 11 Nov 2023 18:57:24 +0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2 5/7] mm: task_mmu: use a folio in smaps_account() Content-Language: en-US To: Matthew Wilcox CC: Andrew Morton , , , David Hildenbrand , Gregory Price References: <20231110033324.2455523-1-wangkefeng.wang@huawei.com> <20231110033324.2455523-6-wangkefeng.wang@huawei.com> From: Kefeng Wang In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.174.177.243] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To dggpemm100001.china.huawei.com (7.185.36.93) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2023/11/11 2:29, Matthew Wilcox wrote: > On Fri, Nov 10, 2023 at 11:33:22AM +0800, Kefeng Wang wrote: >> Replace seven implicit calls to compound_head() with one page_folio(). > > You're so focused on trying to accomplish your goal (killing off the > page_idle and page_young functions) that you're doing a poor job thinkig > about the conversions you're doing along the way. > >> +++ b/fs/proc/task_mmu.c >> @@ -445,23 +445,25 @@ static void smaps_account(struct mem_size_stats *mss, struct page *page, >> { >> int i, nr = compound ? compound_nr(page) : 1; >> unsigned long size = nr * PAGE_SIZE; >> + struct folio *folio = page_folio(page); > > Stop right here. The use of compound_nr() should give you pause. > > After looking at how smaps_account() is used, it seems to me that the > two callers should each pass in PAGE_SIZE or PMD_SIZE instead of doing > this calculation. Yes,this will save extra calculation > > More generally, step back from this series. Do a good job of > transforming fs/proc/task_mmu.c to use folios. Once you've done > that, you can approach the young/idle work again. > Thanks for you advise,will try this firstly. >