From patchwork Thu Jan 12 08:30:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kefeng Wang X-Patchwork-Id: 42298 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp3761428wrt; Thu, 12 Jan 2023 00:24:04 -0800 (PST) X-Google-Smtp-Source: AMrXdXtarGC8NeyqzzgpeOagYs60M+PqXrjCUoo6SIq4KeLyx2UYUqEtTG7rY+JIHgX54MKodX7c X-Received: by 2002:a05:6402:f02:b0:46f:a2c2:405b with SMTP id i2-20020a0564020f0200b0046fa2c2405bmr78200585eda.37.1673511844481; Thu, 12 Jan 2023 00:24:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673511844; cv=none; d=google.com; s=arc-20160816; b=T7MkQD3EVK6k8ZExLZ/9bHfrMxPuWkyKKxb+TR9ypeTVW30GBn5ObA6W43ULufzZff A2FPzNUsBqfmmq212G63cuJaPMfHCg0enC4NZvv2OCEFk5noDI+3Gk0SarPwKM2gdpEn QHob8+2bkO6Pi8CExorfx5R5GRbSpnjsYrM+Z/dTpsYHo0hmCfuRf/J9CIm3qZR6x/t3 UAu8PkJGT7BTUOpI/ZjHPKaYK69AR5ThijHLcCS/OBAqR26BghXTSaxs58UIRp523EB3 K9dweSdbBPaKJHiFYjAiTGzKhhcbzxCPX7c3LgWJAxVpD37wIIa6il2bMTIY/bdz5aLo B7AQ== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ez19-20020a056402451300b00489e993b8easi14843558edb.630.2023.01.12.00.23.41; Thu, 12 Jan 2023 00:24:04 -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 + 99 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 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754804356221352111?= X-GMAIL-MSGID: =?utf-8?q?1754804356221352111?= 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