Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp10669602rwl; Thu, 12 Jan 2023 00:37:00 -0800 (PST) X-Google-Smtp-Source: AMrXdXsBNICTvtpzqY7lRDTKDyn5WP4iaQ2qaa/KfXSvzOYJoDJZbmm8DDLN75BGKgMce8O8HZb6 X-Received: by 2002:a05:6402:540f:b0:479:96c2:61be with SMTP id ev15-20020a056402540f00b0047996c261bemr77621744edb.10.1673512620285; Thu, 12 Jan 2023 00:37:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673512620; cv=none; d=google.com; s=arc-20160816; b=vwirLohmgiIcdBTVzdRR6XPPFbIphxpRdM1RS5fWRcLAjCWDllXHjo9NwPjgInvsv3 gOEaxrOcrcsbE2A/XsKbMCVLSncaXUEpMbVXG0n6V6XRF3UWHqe4yQ9WsgYkjjk7pmyi +bQHNWgBG0pbh/YnFpqLkxj+JaUTG6CY0ZfHDnir7prlH8g3pv47NaLfuJfIQ0aztQ7I gT31bx6ms7TEWcy7DNZdGhre3jJgpBkgPhzppDEv54MV+AOMFFFJwMkbs4+pxDf5TF0f L6d+j30qhLf/F+BlSglsAv6wdAu6/jIzmmcePsOK40WrZPJkc6u/lXv6g9kN+/DuPVmP SfrA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=vPWAoifsdZDSaIY3s2IrQdDt6yOwKVi4WGwzwvvUpwQ=; b=a5EhHHJ+op2tcGnpr30uzgQdn29vYsGaG531AeCWXE3B/dXXqt32YVfemcdnyRqedL i3UBl/ZVaUwXVxlOgZCQNAiAXa2MYi1VQP2WQ7fZDrM3JlAbT+IxU3+Wt6xW+WA7AbtE maC0xd0q8MrATuhhTyGFFLk5Hn56IOcgO/zOhZ8wxWlTjV3XSmP2Q0G/fxMUXBRTQ32t 1x9pgYKHNIvw2Nd0f2ZYykQOLWhTFZdmDABtpF7wdrPvRTYBQE90sRRPbfgCD4Ta2WdB jv3lHD5oqLwlSCjenCZCH3w6bThp7jg2wPkw/9TcPjPnZG8CzZHj7JjGZJUbGjXF6r27 m3NQ== 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 t7-20020a50d707000000b00489df3c748csi17079068edi.154.2023.01.12.00.36.48; Thu, 12 Jan 2023 00:37:00 -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 S239825AbjALISa (ORCPT + 50 others); Thu, 12 Jan 2023 03:18:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52552 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239535AbjALIRx (ORCPT ); Thu, 12 Jan 2023 03:17:53 -0500 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7FA4C3591A for ; Thu, 12 Jan 2023 00:17:35 -0800 (PST) Received: from dggpemm500001.china.huawei.com (unknown [172.30.72.54]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4Nsy315qzgzqV8x; Thu, 12 Jan 2023 16:12:45 +0800 (CST) Received: from localhost.localdomain.localdomain (10.175.113.25) 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; Thu, 12 Jan 2023 16:17:33 +0800 From: Kefeng Wang To: , , CC: , Kefeng Wang Subject: [PATCH -next 4/7] mm: memory: convert page_copy_prealloc() to use a folio Date: Thu, 12 Jan 2023 16:30:03 +0800 Message-ID: <20230112083006.163393-5-wangkefeng.wang@huawei.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20230112083006.163393-1-wangkefeng.wang@huawei.com> References: <20230112083006.163393-1-wangkefeng.wang@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.113.25] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To dggpemm500001.china.huawei.com (7.185.36.107) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,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 The page functions are converted to corresponding to folio functions in page_copy_prealloc(). Signed-off-by: Kefeng Wang --- mm/memory.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/mm/memory.c b/mm/memory.c index f29bca499e0d..b66c425b4d7c 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -958,19 +958,19 @@ static inline struct page * page_copy_prealloc(struct mm_struct *src_mm, struct vm_area_struct *vma, unsigned long addr) { - struct page *new_page; + struct folio *new_folio; - new_page = alloc_page_vma(GFP_HIGHUSER_MOVABLE, vma, addr); - if (!new_page) + new_folio = vma_alloc_folio(GFP_HIGHUSER_MOVABLE, 0, vma, addr, false); + if (!new_folio) return NULL; - if (mem_cgroup_charge(page_folio(new_page), src_mm, GFP_KERNEL)) { - put_page(new_page); + if (mem_cgroup_charge(new_folio, src_mm, GFP_KERNEL)) { + folio_put(new_folio); return NULL; } - cgroup_throttle_swaprate(new_page, GFP_KERNEL); + folio_throttle_swaprate(new_folio, GFP_KERNEL); - return new_page; + return &new_folio->page; } static int -- 2.35.3