From patchwork Tue Jun 18 09:12:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kefeng Wang X-Patchwork-Id: 13702002 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 3F288C27C4F for ; Tue, 18 Jun 2024 09:13:23 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 779268D001F; Tue, 18 Jun 2024 05:13:15 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 205B38D0020; Tue, 18 Jun 2024 05:13:15 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D27638D0022; Tue, 18 Jun 2024 05:13:14 -0400 (EDT) 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 8B0418D0021 for ; Tue, 18 Jun 2024 05:13:14 -0400 (EDT) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 0C869C061C for ; Tue, 18 Jun 2024 09:13:14 +0000 (UTC) X-FDA: 82243445508.09.A0FDED7 Received: from szxga04-in.huawei.com (szxga04-in.huawei.com [45.249.212.190]) by imf07.hostedemail.com (Postfix) with ESMTP id 8E84A4000B for ; Tue, 18 Jun 2024 09:13:11 +0000 (UTC) Authentication-Results: imf07.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf07.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.190 as permitted sender) smtp.mailfrom=wangkefeng.wang@huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1718701987; a=rsa-sha256; cv=none; b=wAMaw6V4M/g9oHeY5FDVnnbA8da487KfO2TEB/344pQcOVkqfG3MLAGHcLWnd/QEPhx5GQ i3gP02uxXPdUvJoVIun7ThnXZ+EaR0Ag5FpjMP/c7sWzIK4qMBrPtpJJHBRNVcLEVMZ943 uu3sqANhxeo3pJu4xWEe4JoxtrggjXI= ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf07.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.190 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=1718701987; 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=nRIjZedw+wW8oKTmRo6eO8q+Cr+8TTKpUyEuUONj+UI=; b=mMFzJ+CJ6UHkXanQfS1LVBqYX1WwDMA+7F0AfqYD3AiJ5xwqCwJtFUtnTjX3w8t0/u1p9Y j2HFSQKSmwzezsZIg9tDJkwXxC7ex7IDye0RJ8/ClCo2RRUfGoI8NWaisdER/GqtByCy5B 5pTqzdl+N11/wy7jWR+LHjHwL0T+Xfg= Received: from mail.maildlp.com (unknown [172.19.163.44]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4W3LYF2WZwz1ytHL; Tue, 18 Jun 2024 17:09:37 +0800 (CST) Received: from dggpemf100008.china.huawei.com (unknown [7.185.36.138]) by mail.maildlp.com (Postfix) with ESMTPS id 7D66B1402D0; Tue, 18 Jun 2024 17:13:08 +0800 (CST) Received: from localhost.localdomain (10.175.112.125) by dggpemf100008.china.huawei.com (7.185.36.138) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Tue, 18 Jun 2024 17:13:08 +0800 From: Kefeng Wang To: Andrew Morton CC: Muchun Song , "Matthew Wilcox (Oracle)" , David Hildenbrand , , Huang Ying , Kefeng Wang Subject: [PATCH v2 4/4] mm: memory: rename pages_per_huge_page to nr_pages Date: Tue, 18 Jun 2024 17:12:42 +0800 Message-ID: <20240618091242.2140164-5-wangkefeng.wang@huawei.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20240618091242.2140164-1-wangkefeng.wang@huawei.com> References: <20240618091242.2140164-1-wangkefeng.wang@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.112.125] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To dggpemf100008.china.huawei.com (7.185.36.138) X-Rspamd-Queue-Id: 8E84A4000B X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: fwxkbnearpmqcw46btoxojxawn5joi5s X-HE-Tag: 1718701991-428206 X-HE-Meta: U2FsdGVkX18xc8Xbqey5ePa+h+0no9+YADL3N9txkU+KJYt+6BVyd9ldljsHYr3dAuUtmODoy+eZKM8VSHoBqEVagxWk/Eu8RFxx39g3SkPg4utcU+EYelaF2E0t06jFyt/qViUo6S5Ny3wwnIOtzfK+oGGgkIl7Pfz8Shy90si3h8U5QX7dzW2lw+TNgFsSQDEVOHOg6eCOo8Ps1IKQdRvl/A73/05mljDvCvQNZ2PZGnC66A4fKo7KuRbbJp6nbetEuq2dG6OvVC/5hiLimJvHB3mH1dQFtqb5cd+1/4a+XI1qJFVweF1a4B/G0XMfTDvELJPIdAPcaZg9wzTxW/LiWjOv6gQ2fNfy55a2ztVuaCQsoa3Q6D1q7JlcKsUegah9ybydLdElWR3ky1BieK52PceHCDXRCLvgNedYyhofMHPrnYt0otk4G8dUcWlQ6V1F7XYfGgBKtRGT0nG4uyl7RGs33+SoehE3hRa0p9NjCmMyQCdZbLfHuwT4ZsGjJGU4pPp6w7JdkIykfi1tFlJE+Td6FnwcKsLMueXcyFUqFz3SB6qC+U4279GGD3SNpr0mkD/ETQxteusKvgdNdopVTi2thIs9VlcvEDRSPvb5osdHAmRkOuPampgA4E39pf5AfIP3sDp2V1dotdU+qxF/4Imh4ALjO9zoQCvY/BlYauCDX5N0LEzIF+xMwx0x3M2AWxvMzeNX18ZgritFHDD5acEBocOTm3vrF6IXUowieQFuLrzBnEmNrW9Q2hcRnTFn5OhdE8773sGEXJZ6ebEobR5KfkEwbePyUznNz1jvqzV4DEbm6gJs/nBKySq0XCb/wFjvNsEBjCj27qun4E03EVcjp2gKfMbH6rtq5VSmtnHb5dr0uzru4+pTFVWtlY4Q3WzMlADaoevIRG8VunKI+R1h/9YJlEwph21j+yaqfhFxuUsJ0waU7Hn8TraQks4myynH9r6LSwNakyr 173QN4fD BdcLCLDmEU7Oi0eX0OLOvWRsk+uuSEQNHuag39I5DRPIk8lzbW3ZI6QwvfJ+EjkmojOJRoGs+s4gv3byqYmE+G/hbGRKmn0qd4gr4xgtMDZkr/81m8W721gBh6JsuoLIaCQ5MNe4o3SYG6XQMJCwY6Sr/+7BhpGdNqYPalfCTXXyXGnk8ujF/M6C6ueLZhs07amfc 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: List-Subscribe: List-Unsubscribe: Since the callers are converted to use nr_pages naming, use it inside too. Signed-off-by: Kefeng Wang --- mm/memory.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/mm/memory.c b/mm/memory.c index 12115e45dc24..d48879e317b3 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -6366,23 +6366,23 @@ EXPORT_SYMBOL(__might_fault); * cache lines hot. */ static inline int process_huge_page( - unsigned long addr_hint, unsigned int pages_per_huge_page, + unsigned long addr_hint, unsigned int nr_pages, int (*process_subpage)(unsigned long addr, int idx, void *arg), void *arg) { int i, n, base, l, ret; unsigned long addr = addr_hint & - ~(((unsigned long)pages_per_huge_page << PAGE_SHIFT) - 1); + ~(((unsigned long)nr_pages << PAGE_SHIFT) - 1); /* Process target subpage last to keep its cache lines hot */ might_sleep(); n = (addr_hint - addr) / PAGE_SIZE; - if (2 * n <= pages_per_huge_page) { + if (2 * n <= nr_pages) { /* If target subpage in first half of huge page */ base = 0; l = n; /* Process subpages at the end of huge page */ - for (i = pages_per_huge_page - 1; i >= 2 * n; i--) { + for (i = nr_pages - 1; i >= 2 * n; i--) { cond_resched(); ret = process_subpage(addr + i * PAGE_SIZE, i, arg); if (ret) @@ -6390,8 +6390,8 @@ static inline int process_huge_page( } } else { /* If target subpage in second half of huge page */ - base = pages_per_huge_page - 2 * (pages_per_huge_page - n); - l = pages_per_huge_page - n; + base = nr_pages - 2 * (nr_pages - n); + l = nr_pages - n; /* Process subpages at the begin of huge page */ for (i = 0; i < base; i++) { cond_resched(); @@ -6421,12 +6421,12 @@ static inline int process_huge_page( } static void clear_gigantic_page(struct folio *folio, unsigned long addr, - unsigned int pages_per_huge_page) + unsigned int nr_pages) { int i; might_sleep(); - for (i = 0; i < pages_per_huge_page; i++) { + for (i = 0; i < nr_pages; i++) { cond_resched(); clear_user_highpage(folio_page(folio, i), addr + i * PAGE_SIZE); } @@ -6456,15 +6456,15 @@ void folio_zero_user(struct folio *folio, unsigned long addr_hint) } static int copy_user_gigantic_page(struct folio *dst, struct folio *src, - unsigned long addr, - struct vm_area_struct *vma, - unsigned int pages_per_huge_page) + unsigned long addr, + struct vm_area_struct *vma, + unsigned int nr_pages) { int i; struct page *dst_page; struct page *src_page; - for (i = 0; i < pages_per_huge_page; i++) { + for (i = 0; i < nr_pages; i++) { dst_page = folio_page(dst, i); src_page = folio_page(src, i);