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: 13097561 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7C46AC54EBD for ; Thu, 12 Jan 2023 08:17:44 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id ECDCE8E0006; Thu, 12 Jan 2023 03:17:41 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id DCE4C8E0003; Thu, 12 Jan 2023 03:17:41 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A74BE900004; Thu, 12 Jan 2023 03:17:41 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 807688E0006 for ; Thu, 12 Jan 2023 03:17:41 -0500 (EST) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 5921D8038E for ; Thu, 12 Jan 2023 08:17:41 +0000 (UTC) X-FDA: 80345443122.12.BD1162F Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by imf08.hostedemail.com (Postfix) with ESMTP id E8BC0160003 for ; Thu, 12 Jan 2023 08:17:38 +0000 (UTC) Authentication-Results: imf08.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf08.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=wangkefeng.wang@huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1673511459; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=vPWAoifsdZDSaIY3s2IrQdDt6yOwKVi4WGwzwvvUpwQ=; b=nV3mgWfzyLyqzqh/zzTm4WZiFPEGXZ5b4nx8a8QH2p1sVzzfhlE9J0L6D+xpabb5ekOsh3 GwEes8wcnD0eX6BV0ePi8yXcNPCSazaQ0pqOdRSuWv2a8vrSwmlBA0rLrmsILsWB0lEzY6 EjXJJ4eyXqmvb7p4vTQCzsrzJGLXzb0= ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf08.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=wangkefeng.wang@huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1673511459; a=rsa-sha256; cv=none; b=bmWRYy0ntXSe4kv0YQW6O0fAsBpETbX/g/9PtihCYFIhGfVGP0O/69qs4gwkMFtGjqEv/z D+82eqBtjG24RGi3qH8nA+NMnLiaVsGPnGMk67yg/YAW6uClDmG4lvGlyjl9Qp0gWAl7Ev qzj0djJpzZtfKRxsz0IAwqDtZ4/mSzI= 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-Rspam-User: X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: E8BC0160003 X-Stat-Signature: n1sm3e8oaekiahmj1sg6k1cbjmk689dx X-HE-Tag: 1673511458-740604 X-HE-Meta: U2FsdGVkX1+0uZTWT5V1/nDIOisHp4XUKfuDyzfxckUIrJN8xFQMOQgD2e21wsT1zJiMA4/uykuc5LPQCj2UtWCBmzmxOl2ljpMcgyMS5/haldcE424eAdFTE71XV4dwwz89BWK5TgP1KqIF0PhUe4giY0ed7yh7ZnJWQrWzn0knllK99hn1S6Es/uiQB94Ba0CaqWgp6diocxp5guwNkdrBEQRfmDZJTVWRP06mvm0CbUImG8I7MXUOC5hLF0hYorymkUqf9TmWVlXFykX/+qxjnOYJc5rl3ImSpKLf0TB+x3Lmfsy5b9oLEGUGzGp3VCToIsRnws0N7vmRiFXl1psNKiLgxN+8hiT2SejkYVKaRQ3L/pSpDkakLY1mg3WzMzjU/UlRgoKiLzok32BUz4tko+AHin43cBj8s1EAf6xxcoFAzTCCx1TgN7LhSbPWQ7N90TWAwrAgt+VSKANLA5APnpBJRaY1rA6c+g2z7mBfB1XxzX8Tnj69m7T21msgOJed+jLSxxHkR/Lo7EFi8c4PgJix23KHXLn9oh8wN+G81drPe7Sdr+F5mf+J4BMh/jVnUp/f1leJFUEvYGfsANUqgBmpy9MjRXVF2oCdhu/0QPiiR01PYDzrhtm3IMXI3UHTsdcBrjY83QU1be6GyemTymF4PVSWiC6TmjkyQVhWhIpy4w7uynurIEoxvuVqDQGavOy3ygeI61vjqixsxUNJyNJZHmyaKCDw07P9732ImTjHw5+5j2YG0JhSRacbpkg6CgzTcobT63F/gu6l2ETvqNuyE6/SGugA11GTkhyASQeoF17kR/2WuB4dXcioNcScyZa3PN5VD6gVShkpDXv87lojdPb/K2k1Sm6QZGsPPXKfi4nSZGFJMS7EmAuZJQAZfrGMLO0KVFFTlGJrGl6euab2AApy X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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