Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp3121090rwb; Mon, 16 Jan 2023 04:06:06 -0800 (PST) X-Google-Smtp-Source: AMrXdXuKIf0vck9SISLBnL1J6xGmQdXurWuqcF7siFEIGTtFgjwPRXtcEFdroGfsd9jlkJvLTrQz X-Received: by 2002:a17:907:7da0:b0:871:de7e:94ea with SMTP id oz32-20020a1709077da000b00871de7e94eamr721579ejc.6.1673870766153; Mon, 16 Jan 2023 04:06:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673870766; cv=none; d=google.com; s=arc-20160816; b=GtwK+h0ckEPoobv0UjzARtutczzgHz7GkH4TKevzRde7KfrAdPyVt4ffeJF+ozArwW jCJ9CvS/QIuCOT/IG7uFuwJ+0v2v0ConggZp0Ysjd4Fb8fAKs4AHTkvro3D/Sm99qMQa jMF0xpt1ojumxUb4FWZkZtd4x/mWH+qNrAVWpRag0HDKllzYQU0bwN9vi+iEpsd1jOuW SVl6adoKo9nzNqryaF2BT8mgrOW/Bq+tGyAZ9Cqp9Qa06N4jVUdLOEvgkDrezngTJrTL coOfNt+1F7KtsS8HAP+TMj/UUmASeQbkA/xl/2Y0FpEDVPIg+e/T04sAdpsD/WDlk6Ad PyQQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=WfL4x+ToPo1HU6DwcCeAgVvCndSHDlLTLG58dNcss40=; b=Rb2UA13CVZZeSgUB5131k/HRsgJifo8REBgAOClbxkqUqXLMh31AZ7gHTSZznWeadx D1zTnxAQl0GL6Fi2A5wzDc8XeUjMVfV7nhwjhJRStQw4Zdj1/qa/RKHXv7O5SRITXXiB U8hsCrL3dPffk8pwpXngD1DL7V69fF8/13BCfo0p3xEYMamA7XPU9pdRAWo8f30fv1a4 YJm1lcxXPwIz9U9f1NDoOnFaltNF+e32Lm8bnBF+lKCc8xBPt5sKO2nvfldrJb+GU/jq MZHmU0umJA8t27T3GXf5/ORv0p41T3CLrbLXjor5Rp8IJWXjCUmlQmgYeKhaR7ZkL1m8 NFtQ== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id be5-20020a1709070a4500b007e08e2619e7si30523618ejc.860.2023.01.16.04.05.53; Mon, 16 Jan 2023 04:06:06 -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; 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; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229775AbjAPLLd (ORCPT + 51 others); Mon, 16 Jan 2023 06:11:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41152 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229633AbjAPLLb (ORCPT ); Mon, 16 Jan 2023 06:11:31 -0500 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7796930FB for ; Mon, 16 Jan 2023 03:11:30 -0800 (PST) Received: from dggpemm500001.china.huawei.com (unknown [172.30.72.54]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4NwTnQ6npQz16N8W; Mon, 16 Jan 2023 19:09:46 +0800 (CST) Received: from [10.174.177.243] (10.174.177.243) by dggpemm500001.china.huawei.com (7.185.36.107) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Mon, 16 Jan 2023 19:11:28 +0800 Message-ID: <8b26ceaa-79b4-4c3e-c37a-e191b3403358@huawei.com> Date: Mon, 16 Jan 2023 19:11:27 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.5.1 Subject: Re: [PATCH -next 2/7] mm: memory: convert do_anonymous_page() to use a folio Content-Language: en-US To: Matthew Wilcox CC: , , References: <20230112083006.163393-1-wangkefeng.wang@huawei.com> <20230112083006.163393-3-wangkefeng.wang@huawei.com> From: Kefeng Wang In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.174.177.243] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To dggpemm500001.china.huawei.com (7.185.36.107) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_PASS 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 2023/1/13 23:33, Matthew Wilcox wrote: > On Thu, Jan 12, 2023 at 04:30:01PM +0800, Kefeng Wang wrote: >> Convert do_anonymous_page() to use a folio and replace related functions >> to folio functions. > > I think this patch has a prerequisite of sorting out > alloc_zeroed_user_highpage_movable(). That way we can get rid of > the 'page' variable inside this function altogether. How about provide a wrapper like folio_alloc_zeroed_user_highmem_movable(), but the is a little bit long. static inline struct folio * folio_alloc_zeroed_user_highmem_movable(struct vm_area_struct *vma, unsigned long vaddr) { struct folio *folio = NULL; struct page *page; page = alloc_zeroed_user_highpage_movable(vma, vaddr); if (page) folio = page_folio(page); return folio; } > >> inc_mm_counter(vma->vm_mm, MM_ANONPAGES); >> page_add_new_anon_rmap(page, vma, vmf->address); > > folio_add_new_anon-rmap(). ok, will update. > >> - lru_cache_add_inactive_or_unevictable(page, vma); >> + folio_add_lru_vma(folio, vma);