From patchwork Fri Nov 10 03:33:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kefeng Wang X-Patchwork-Id: 163766 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b129:0:b0:403:3b70:6f57 with SMTP id q9csp864833vqs; Thu, 9 Nov 2023 19:34:30 -0800 (PST) X-Google-Smtp-Source: AGHT+IEAQknh5tj+QPiKQYko28PEcTSGzE7euJXEsD3EsKpbp/Bk54mx/wrY24i06NF0Phx/58qA X-Received: by 2002:ac5:cb08:0:b0:4ab:f2e1:9e05 with SMTP id r8-20020ac5cb08000000b004abf2e19e05mr3280066vkl.9.1699587270542; Thu, 09 Nov 2023 19:34:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699587270; cv=none; d=google.com; s=arc-20160816; b=acndf4MSsEmREnEBJBiVy2SonQ1NzB8/bVPe3V2FWQxTw4xRl3jfUF3VycvdmlqYHo 6eclJLzbaFqt8nBYH+jHVFKf6fA/blcHmzTafxq4CgbDzjqLuyO56n9zmTlccNPKMud+ 8ocD0qi/MMOOMNz8J931xJ9HMimWy5sKxpA7a6//sRJYw9kSm+8HbpciuLU8+4Ps0Ttx 90a3/F0GPz6g98kgPsSM9QfPsm1Zk56oklu8Eai3PcPrWsUa9F7GF6ubrKPFFXNBQVNg kQvKso4qX+yDjIJgwgMxdVBsx9Runh6GGhA2lwEK40adUujxpOQ7ieuD6b/6MzTLYpjC nWDA== 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=xOb+y0XMkGGquyk/OT8zd4iZd7TUkuv++N8cKE08zJY=; fh=Ig0AqGQMuH358nWWGrnHSF2kv4xbMV1Ws+OHgkmQS6g=; b=MFRQIWx7VyeHbPbG76HAQudZeKfaHJPiZZc+3tD5qa3DI0gYCaTo5sU/q4n/tK1JDI NSn45U8lUkzqI4Be+VL8ShlTUqI3yVUuV4U48E3rF6UkmFKBOre6iJjzDuTNnGYPngh1 6sqUbfYaB2RGEqFuyP6ruUECbbl05GPG4MhN4eTdk69uHBHNGUR2wV+ezpL0ZKukuwsY YbKT9KcsJTyZMfhD05mYyVYhFfV+XgwcJ1AppxbA2Oj7y9SLNnKHcsIe8ZEwIF9WqASp 14IpxPkxR6CFSl1htsP+EtYU0c5s5CqarVfiLd7h7BCkHLGJwYwneGDkuu31NxwkB8W+ c/Zw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 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 agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id w11-20020a056a0014cb00b006c3388579a6si17696253pfu.248.2023.11.09.19.34.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Nov 2023 19:34:30 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 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 (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id A13AD82B254F; Thu, 9 Nov 2023 19:34:17 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345815AbjKJDd7 (ORCPT + 30 others); Thu, 9 Nov 2023 22:33:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37682 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229627AbjKJDdx (ORCPT ); Thu, 9 Nov 2023 22:33:53 -0500 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5A5864681 for ; Thu, 9 Nov 2023 19:33:50 -0800 (PST) Received: from dggpemm100001.china.huawei.com (unknown [172.30.72.55]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4SRPV373CDz1P8F1; Fri, 10 Nov 2023 11:30:35 +0800 (CST) Received: from localhost.localdomain (10.175.112.125) by dggpemm100001.china.huawei.com (7.185.36.93) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Fri, 10 Nov 2023 11:33:48 +0800 From: Kefeng Wang To: Andrew Morton CC: , , Matthew Wilcox , David Hildenbrand , Gregory Price , Kefeng Wang Subject: [PATCH v2 1/7] fs/proc/page: remove unneeded PageTail && PageSlab check Date: Fri, 10 Nov 2023 11:33:18 +0800 Message-ID: <20231110033324.2455523-2-wangkefeng.wang@huawei.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20231110033324.2455523-1-wangkefeng.wang@huawei.com> References: <20231110033324.2455523-1-wangkefeng.wang@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.112.125] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To dggpemm100001.china.huawei.com (7.185.36.93) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Thu, 09 Nov 2023 19:34:17 -0800 (PST) X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782146421398836798 X-GMAIL-MSGID: 1782146421398836798 After commit dcb351cd095a ("page-flags: define behavior SL*B-related flags on compound pages"), the slab could not be a tail, remove unneeded PageTail && PageSlab check. Signed-off-by: Kefeng Wang --- fs/proc/page.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/fs/proc/page.c b/fs/proc/page.c index 195b077c0fac..466efb0dadf7 100644 --- a/fs/proc/page.c +++ b/fs/proc/page.c @@ -184,9 +184,6 @@ u64 stable_page_flags(struct page *page) u |= kpf_copy_bit(k, KPF_LOCKED, PG_locked); u |= kpf_copy_bit(k, KPF_SLAB, PG_slab); - if (PageTail(page) && PageSlab(page)) - u |= 1 << KPF_SLAB; - u |= kpf_copy_bit(k, KPF_ERROR, PG_error); u |= kpf_copy_bit(k, KPF_DIRTY, PG_dirty); u |= kpf_copy_bit(k, KPF_UPTODATE, PG_uptodate); From patchwork Fri Nov 10 03:33:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kefeng Wang X-Patchwork-Id: 163767 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b129:0:b0:403:3b70:6f57 with SMTP id q9csp864876vqs; Thu, 9 Nov 2023 19:34:36 -0800 (PST) X-Google-Smtp-Source: AGHT+IF9jnA/n1KxGBBW0m9mncmLKvyasWxUx94WdQ+6Ee6NkkMS/Yy2r0PdtDXgj2vps/+qTGRp X-Received: by 2002:a05:6871:e70d:b0:1e9:e975:4413 with SMTP id qa13-20020a056871e70d00b001e9e9754413mr9595726oac.27.1699587276671; Thu, 09 Nov 2023 19:34:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699587276; cv=none; d=google.com; s=arc-20160816; b=N+M9ntvbanZP3kaeUjFArBgTS/IcVn/xdeOG2cdZFGnQc8r58HcYekShUUk5lSXtV7 Hka6OlFytkzUrVnJLxdFZXTQGLgJlly91+xqyVl0U/uYcKnsNtIh6dpO/oYuGfvhB5IB O+8mUNVzSneSOdkMOnBm3DayLJt1ZOnfmME/fQsu5BCbZrOTUPfV35WniroRjCJfABde JbGiZ2wuAnht7IeIN31L/N85fOJQfb2UrjGpOVs70A7ZXA99fdjhDGB9KppGs9+vI6xN q0tzkAFgR8V2wLepHC1eC3B+/AsCKEZi2cb6aUupXVPodOWz+sfPE1ezyXQjlQ2Y2F99 c+GQ== 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=7m1Pxk98srFU0kXtPDQlyvtZ89qCO4y/HQx1e+D5jmw=; fh=Ig0AqGQMuH358nWWGrnHSF2kv4xbMV1Ws+OHgkmQS6g=; b=zL+CCmv/eZQ8G0D+GuL9wtpOt5dUB2riUWj+o5xCL1Mp3RsURBcJLAgTOBjBHxueHG qlJL5gOSZWoLdU81ubQMUjQG0kysJ3xVGZyCpPewbMBaqyAajsM2e7+usdnWtwZ/1J7h ktVbIw58cL8o695FYOyECQCpF+Q4auEB+PME9oYr6EE5L8lHWI2r+3qPbbkulnORkCEp GPjjRDGHgQOF9QzYPuNfwej7SX955/cvHxq1NKuCt2b1YyPcmq96gvE2x5OucUCmuFLd 7Bh3ftLRhyDAhFOI3dOpWyT8DlaDSGy9iIznlPIG8RDyzk9ZLgi9IyUoV1z1omBZbG7O QSNA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 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 agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id p12-20020a056a000b4c00b006c4d1f10b8asi1200356pfo.99.2023.11.09.19.34.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Nov 2023 19:34:36 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 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 (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id CE1BD82B0F4F; Thu, 9 Nov 2023 19:34:27 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345824AbjKJDeA (ORCPT + 30 others); Thu, 9 Nov 2023 22:34:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37702 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229629AbjKJDdx (ORCPT ); Thu, 9 Nov 2023 22:33:53 -0500 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7F0324686 for ; Thu, 9 Nov 2023 19:33:50 -0800 (PST) Received: from dggpemm100001.china.huawei.com (unknown [172.30.72.54]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4SRPV436p6z1P8F9; Fri, 10 Nov 2023 11:30:36 +0800 (CST) Received: from localhost.localdomain (10.175.112.125) by dggpemm100001.china.huawei.com (7.185.36.93) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Fri, 10 Nov 2023 11:33:48 +0800 From: Kefeng Wang To: Andrew Morton CC: , , Matthew Wilcox , David Hildenbrand , Gregory Price , Kefeng Wang Subject: [PATCH v2 2/7] fs/proc/page: use a folio in stable_page_flags() Date: Fri, 10 Nov 2023 11:33:19 +0800 Message-ID: <20231110033324.2455523-3-wangkefeng.wang@huawei.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20231110033324.2455523-1-wangkefeng.wang@huawei.com> References: <20231110033324.2455523-1-wangkefeng.wang@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.112.125] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To dggpemm100001.china.huawei.com (7.185.36.93) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Thu, 09 Nov 2023 19:34:27 -0800 (PST) X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782146428126330939 X-GMAIL-MSGID: 1782146428126330939 Replace nine compound_head() calls with one page_folio(). Signed-off-by: Kefeng Wang --- fs/proc/page.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/fs/proc/page.c b/fs/proc/page.c index 466efb0dadf7..dcef02471f91 100644 --- a/fs/proc/page.c +++ b/fs/proc/page.c @@ -109,6 +109,7 @@ static inline u64 kpf_copy_bit(u64 kflags, int ubit, int kbit) u64 stable_page_flags(struct page *page) { + struct folio *folio; u64 k; u64 u; @@ -119,6 +120,7 @@ u64 stable_page_flags(struct page *page) if (!page) return 1 << KPF_NOPAGE; + folio = page_folio(page); k = page->flags; u = 0; @@ -128,11 +130,11 @@ u64 stable_page_flags(struct page *page) * Note that page->_mapcount is overloaded in SLAB, so the * simple test in page_mapped() is not enough. */ - if (!PageSlab(page) && page_mapped(page)) + if (!folio_test_slab(folio) && folio_mapped(folio)) u |= 1 << KPF_MMAP; - if (PageAnon(page)) + if (folio_test_anon(folio)) u |= 1 << KPF_ANON; - if (PageKsm(page)) + if (folio_test_ksm(folio)) u |= 1 << KPF_KSM; /* @@ -152,11 +154,9 @@ u64 stable_page_flags(struct page *page) * to make sure a given page is a thp, not a non-huge compound page. */ else if (PageTransCompound(page)) { - struct page *head = compound_head(page); - - if (PageLRU(head) || PageAnon(head)) + if (folio_test_lru(folio) || folio_test_anon(folio)) u |= 1 << KPF_THP; - else if (is_huge_zero_page(head)) { + else if (is_huge_zero_page(&folio->page)) { u |= 1 << KPF_ZERO_PAGE; u |= 1 << KPF_THP; } @@ -170,7 +170,7 @@ u64 stable_page_flags(struct page *page) */ if (PageBuddy(page)) u |= 1 << KPF_BUDDY; - else if (page_count(page) == 0 && is_free_buddy_page(page)) + else if (folio_ref_count(folio) == 0 && is_free_buddy_page(page)) u |= 1 << KPF_BUDDY; if (PageOffline(page)) @@ -178,7 +178,7 @@ u64 stable_page_flags(struct page *page) if (PageTable(page)) u |= 1 << KPF_PGTABLE; - if (page_is_idle(page)) + if (folio_test_idle(folio)) u |= 1 << KPF_IDLE; u |= kpf_copy_bit(k, KPF_LOCKED, PG_locked); @@ -194,7 +194,7 @@ u64 stable_page_flags(struct page *page) u |= kpf_copy_bit(k, KPF_ACTIVE, PG_active); u |= kpf_copy_bit(k, KPF_RECLAIM, PG_reclaim); - if (PageSwapCache(page)) + if (folio_test_swapcache(folio)) u |= 1 << KPF_SWAPCACHE; u |= kpf_copy_bit(k, KPF_SWAPBACKED, PG_swapbacked); From patchwork Fri Nov 10 03:33:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kefeng Wang X-Patchwork-Id: 163770 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b129:0:b0:403:3b70:6f57 with SMTP id q9csp864975vqs; Thu, 9 Nov 2023 19:34:48 -0800 (PST) X-Google-Smtp-Source: AGHT+IGsJJE+KuAVPDU3F4JV/amvE1dlANxT8aEfVwTy3TNEG/Ij7pQCQH1KjuGNGnxh5koMko/P X-Received: by 2002:a05:6a00:398d:b0:6be:130a:22a0 with SMTP id fi13-20020a056a00398d00b006be130a22a0mr6742873pfb.14.1699587288507; Thu, 09 Nov 2023 19:34:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699587288; cv=none; d=google.com; s=arc-20160816; b=jkL/JT1tlI7ARafzmoGddgs8S17AYDpk+/x4FwtlCBwOp8G40OllK3QbDU2aKK9ZJj snRm/pGENRub+PhV8iBtoElPWVss44o3Cg/3+ahm/Q7ZtBSyjXTdWAqhJ3PwJ2NQT1YX qBhUv2M5Bc6cSI/czjZ+NbhytZxjxGzIHdeDJNwS2+0thBWcMdErzcVGNGFttxNNlDr1 G9ZUnJ11V3yz1c3orjVmPnbdl09AQyAfQ7gGjGlY/mE30J6ild9xAxIe1vRd7/ImcDQo YnlwmgygFHXkhV9SXclh3WCnTyHRB8TLaovpguMKSZFj+fuZZDIGCEXiVO7imUGwjjlT WeHQ== 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=wl3f0dMey2iPkg5BQNRHLLycD41VYwvBbiVoQfJeshQ=; fh=Ig0AqGQMuH358nWWGrnHSF2kv4xbMV1Ws+OHgkmQS6g=; b=yvq6th0fRtD3oqUfOHH+T1c8qhFHDhEhZhriZz4H4ffiOaVMCR/kxg9ued8dNYkowv COrsxHOB7UeLfP9wGsWVYIgn4rW+usz7XbUgiiYpE84ayKT92T8LlGzFs3uxKiP4EYsQ hsoKR2/z/wo5W+RFgr/JYOfNmRNbhnzQLXSJdKFn5ffJqL35cUw8Feq1wSJynWAJ0u+y 0pBiI3eu2pso1eXwt5Wd1nMG2707j+IoeEoVMj0UCb8YeNlt8riKHeyLtN9V1wdlT+D2 QVdt5FWznLzaM2YPQMYSLFIz4gUiWwXruvcqpTW3H1l5mmqjFK+pzHYNlYVyu6Tt5OU6 R6ug== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 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 lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id y9-20020a056a001c8900b006c145e1210csi16878626pfw.323.2023.11.09.19.34.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Nov 2023 19:34:48 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 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 (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id B8D9982E1D57; Thu, 9 Nov 2023 19:34:42 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345860AbjKJDeG (ORCPT + 30 others); Thu, 9 Nov 2023 22:34:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37718 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234881AbjKJDdx (ORCPT ); Thu, 9 Nov 2023 22:33:53 -0500 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1056F44BD for ; Thu, 9 Nov 2023 19:33:51 -0800 (PST) Received: from dggpemm100001.china.huawei.com (unknown [172.30.72.54]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4SRPV46W0Gz1P89B; Fri, 10 Nov 2023 11:30:36 +0800 (CST) Received: from localhost.localdomain (10.175.112.125) by dggpemm100001.china.huawei.com (7.185.36.93) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Fri, 10 Nov 2023 11:33:49 +0800 From: Kefeng Wang To: Andrew Morton CC: , , Matthew Wilcox , David Hildenbrand , Gregory Price , Kefeng Wang Subject: [PATCH v2 3/7] fs/proc/page: respect folio head-page flag placement Date: Fri, 10 Nov 2023 11:33:20 +0800 Message-ID: <20231110033324.2455523-4-wangkefeng.wang@huawei.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20231110033324.2455523-1-wangkefeng.wang@huawei.com> References: <20231110033324.2455523-1-wangkefeng.wang@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.112.125] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To dggpemm100001.china.huawei.com (7.185.36.93) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Thu, 09 Nov 2023 19:34:42 -0800 (PST) X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782146440355867052 X-GMAIL-MSGID: 1782146440355867052 kpageflags reads page-flags directly from the page, even when the respective flag is only updated on the headpage of a folio. Since most flags are stored in head flags, make k = folio->flags, and add new p = page->flags used for per-page flags. Originally-from: Gregory Price Suggested-by: Matthew Wilcox Signed-off-by: Kefeng Wang --- fs/proc/page.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/fs/proc/page.c b/fs/proc/page.c index dcef02471f91..553a7c921cb4 100644 --- a/fs/proc/page.c +++ b/fs/proc/page.c @@ -110,8 +110,7 @@ static inline u64 kpf_copy_bit(u64 kflags, int ubit, int kbit) u64 stable_page_flags(struct page *page) { struct folio *folio; - u64 k; - u64 u; + u64 k, p, u; /* * pseudo flag: KPF_NOPAGE @@ -121,7 +120,8 @@ u64 stable_page_flags(struct page *page) return 1 << KPF_NOPAGE; folio = page_folio(page); - k = page->flags; + k = folio->flags; + p = page->flags; u = 0; /* @@ -202,7 +202,7 @@ u64 stable_page_flags(struct page *page) u |= kpf_copy_bit(k, KPF_MLOCKED, PG_mlocked); #ifdef CONFIG_MEMORY_FAILURE - u |= kpf_copy_bit(k, KPF_HWPOISON, PG_hwpoison); + u |= kpf_copy_bit(p, KPF_HWPOISON, PG_hwpoison); #endif #ifdef CONFIG_ARCH_USES_PG_UNCACHED @@ -211,13 +211,13 @@ u64 stable_page_flags(struct page *page) u |= kpf_copy_bit(k, KPF_RESERVED, PG_reserved); u |= kpf_copy_bit(k, KPF_MAPPEDTODISK, PG_mappedtodisk); - u |= kpf_copy_bit(k, KPF_PRIVATE, PG_private); - u |= kpf_copy_bit(k, KPF_PRIVATE_2, PG_private_2); - u |= kpf_copy_bit(k, KPF_OWNER_PRIVATE, PG_owner_priv_1); + u |= kpf_copy_bit(p, KPF_PRIVATE, PG_private); + u |= kpf_copy_bit(p, KPF_PRIVATE_2, PG_private_2); + u |= kpf_copy_bit(p, KPF_OWNER_PRIVATE, PG_owner_priv_1); u |= kpf_copy_bit(k, KPF_ARCH, PG_arch_1); #ifdef CONFIG_ARCH_USES_PG_ARCH_X - u |= kpf_copy_bit(k, KPF_ARCH_2, PG_arch_2); - u |= kpf_copy_bit(k, KPF_ARCH_3, PG_arch_3); + u |= kpf_copy_bit(p, KPF_ARCH_2, PG_arch_2); + u |= kpf_copy_bit(p, KPF_ARCH_3, PG_arch_3); #endif return u; From patchwork Fri Nov 10 03:33:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kefeng Wang X-Patchwork-Id: 163765 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b129:0:b0:403:3b70:6f57 with SMTP id q9csp864743vqs; Thu, 9 Nov 2023 19:34:14 -0800 (PST) X-Google-Smtp-Source: AGHT+IGGPn+1pTPHR/kxiwlEjtDXbjgKgER7ydFnkekipfhh6/D4a6/5rwPqaY0eZEFfgXuK/FQb X-Received: by 2002:a17:902:d492:b0:1cc:4d99:36f2 with SMTP id c18-20020a170902d49200b001cc4d9936f2mr7015993plg.56.1699587254325; Thu, 09 Nov 2023 19:34:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699587254; cv=none; d=google.com; s=arc-20160816; b=ZODS/8nlUuTojuDZmK1nyRobljn8CWnN0OyInt3+Zq8hYS2xCW62bMujeqw4jaKLRc j8F/iX/zhWmdYNZAc4vmLxLuKaOpiV1U4qDQ4AoxK5inm2X4/68yBFARDVWIar6zTsYr CjHCNl3ta5d5vWSCXmy+0c3VOslaZzAGO1Id7BSMyO8YHDo9zNXRVj3AS/pSyGlrbZxH bxEZa7NVzR6qqqlOauGVP0a9zaVyOOU5W+bOOcRdQfeQDxaxCR15BFm3REZ3ndH7mWMV DxLeyL5OGckexyPI4unv0G2UfmnyzBbZBkX8Co08VigCoVX9+BU2wcjAO2gDjrQN04bb 5cCg== 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=4dxVUuHF6euSr2sshfFVKaKxOUe39k/DIgthsc5PjZY=; fh=Ig0AqGQMuH358nWWGrnHSF2kv4xbMV1Ws+OHgkmQS6g=; b=jix2IG41OOmfFtyQoTEgpFm4qRcDmdNg6golmtZFVyK/hiTSeuJCis8aJ29P8nQL14 2yFphnEXY+KHFg6d40/Hzo4sWR+3nWELbLlPTa988tdeHJluOX396dp0y6OhOY8HwTPL wPbffZ7EYdY0v1beiaGqWfeHkrfA3fj9ZU9ZwsX/ruL0ZNVbFrmQB1MFdk1qauikG3Er H2SyMqVEDWTxbZafkYafuIIoxzPRQTvaxJxRhP7nMhEKohS/f0qcUpX/b7GRceh14Ad3 MbQ+zcNNfsytzweBaL4ZzUssM8F3liFxdG71MTmI0jRKqw5DryrokYaP8iSzbzer2H8G J4hg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id f5-20020a170902ce8500b001b8921fbd87si7174131plg.490.2023.11.09.19.34.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Nov 2023 19:34:14 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id A953A83B4594; Thu, 9 Nov 2023 19:34:12 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345850AbjKJDeE (ORCPT + 30 others); Thu, 9 Nov 2023 22:34:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37732 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345803AbjKJDdy (ORCPT ); Thu, 9 Nov 2023 22:33:54 -0500 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F0D9744BD for ; Thu, 9 Nov 2023 19:33:51 -0800 (PST) Received: from dggpemm100001.china.huawei.com (unknown [172.30.72.56]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4SRPYb14PNzfb7T; Fri, 10 Nov 2023 11:33:39 +0800 (CST) Received: from localhost.localdomain (10.175.112.125) by dggpemm100001.china.huawei.com (7.185.36.93) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Fri, 10 Nov 2023 11:33:49 +0800 From: Kefeng Wang To: Andrew Morton CC: , , Matthew Wilcox , David Hildenbrand , Gregory Price , Kefeng Wang Subject: [PATCH v2 4/7] mm: huge_memory: use more folio api in __split_huge_page_tail() Date: Fri, 10 Nov 2023 11:33:21 +0800 Message-ID: <20231110033324.2455523-5-wangkefeng.wang@huawei.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20231110033324.2455523-1-wangkefeng.wang@huawei.com> References: <20231110033324.2455523-1-wangkefeng.wang@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.112.125] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To dggpemm100001.china.huawei.com (7.185.36.93) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Thu, 09 Nov 2023 19:34:12 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782146405065558851 X-GMAIL-MSGID: 1782146405065558851 Use more folio APIs to save six compound_head() calls in __split_huge_page_tail(). Signed-off-by: Kefeng Wang Reviewed-by: Matthew Wilcox (Oracle) --- mm/huge_memory.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/mm/huge_memory.c b/mm/huge_memory.c index 3f74a063f7d1..2b03c55ea425 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -2509,13 +2509,13 @@ static void __split_huge_page_tail(struct folio *folio, int tail, clear_compound_head(page_tail); /* Finally unfreeze refcount. Additional reference from page cache. */ - page_ref_unfreeze(page_tail, 1 + (!PageAnon(head) || - PageSwapCache(head))); + page_ref_unfreeze(page_tail, 1 + (!folio_test_anon(folio) || + folio_test_swapcache(folio))); - if (page_is_young(head)) - set_page_young(page_tail); - if (page_is_idle(head)) - set_page_idle(page_tail); + if (folio_test_young(folio)) + folio_set_young(new_folio); + if (folio_test_idle(folio)) + folio_set_idle(new_folio); folio_xchg_last_cpupid(new_folio, folio_last_cpupid(folio)); From patchwork Fri Nov 10 03:33:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kefeng Wang X-Patchwork-Id: 163769 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b129:0:b0:403:3b70:6f57 with SMTP id q9csp864965vqs; Thu, 9 Nov 2023 19:34:47 -0800 (PST) X-Google-Smtp-Source: AGHT+IGI0LTzKItB+MhWPl8YGaebV5C4cVs9JpAD5tt71ATQlDRvCZcLYb5RWnghgKsaNM8eCZva X-Received: by 2002:a05:6a20:da93:b0:13c:ca8b:7e29 with SMTP id iy19-20020a056a20da9300b0013cca8b7e29mr8743292pzb.12.1699587287441; Thu, 09 Nov 2023 19:34:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699587287; cv=none; d=google.com; s=arc-20160816; b=mUG+WPpZyjuZOVbmVZmk/DIrOC5v5Dq7qBZrDa/h1F7cI2dLF2SNlO84pR5a5yWFbx KR/uB6cTLCmACL40htUBzuPRa9uhpO/NUpZfA7sGNWvzUV4hgWmubtSNw30ZgbinzqF4 aeZzG5ssYXTJmWty+K8ijosgBHmbPKytpGXPCZp3f6ZFlUTGag78j3kfLhTnDilVNYSK R3a2C9KoqjT2bWEl0dUkAPch0W5iczL27ppvDrGWYbR8BeM/gXVCI7vsS7T0vnAXLmwR SXrFuFzZulqP1r01fAaqJ+PCd05TSTLkGpWaWaz2UkfPjkdmrfVN+6UHO2pKNOta5w/6 vsfw== 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=EaJLPcZe74hOHKLXknVt3PsmvfGOnExzjig3UfkxqBs=; fh=Ig0AqGQMuH358nWWGrnHSF2kv4xbMV1Ws+OHgkmQS6g=; b=AqiSwX4G5XmFmFecpQGEiNGNZ5cSkQVvI6MzSDmmwjWGb/fA96ZBxnZfOdYDb24qvk XD3uB/13ptFdjkF/qDsZK7jHxXlPB1UPYNJ1JhgFx5JhCwUWkQ5XzlOYh59OCctyBM8d yOkb8HP/R2jHOynsgCUerXqpYtRQEAkqG/6ywGEQ2p5p4cDENUmKhRF7BeiBc0Y6Gl77 s7myi6lmBY2Sr15CwwzbegDOddT5yw8gnoCQMaWUJdEAT6kzrsmfq4ItIwVbYxVpR8Nz tmFzfO6zR+kXlJfhyLiRTh8tZmWK8LVE6DDdRoz1gQmdEYsqZi9SGJU9nuRiSD5nsWKI c32w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 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 agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id h13-20020a17090acf0d00b0026c198d8182si3245672pju.105.2023.11.09.19.34.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Nov 2023 19:34:47 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 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 (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 8D7CC82B0F4A; Thu, 9 Nov 2023 19:34:43 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234896AbjKJDeK (ORCPT + 30 others); Thu, 9 Nov 2023 22:34:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37734 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345807AbjKJDdz (ORCPT ); Thu, 9 Nov 2023 22:33:55 -0500 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2ADA64681 for ; Thu, 9 Nov 2023 19:33:52 -0800 (PST) Received: from dggpemm100001.china.huawei.com (unknown [172.30.72.56]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4SRPV46ygbzmXKT; Fri, 10 Nov 2023 11:30:36 +0800 (CST) Received: from localhost.localdomain (10.175.112.125) by dggpemm100001.china.huawei.com (7.185.36.93) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Fri, 10 Nov 2023 11:33:50 +0800 From: Kefeng Wang To: Andrew Morton CC: , , Matthew Wilcox , David Hildenbrand , Gregory Price , Kefeng Wang Subject: [PATCH v2 5/7] mm: task_mmu: use a folio in smaps_account() Date: Fri, 10 Nov 2023 11:33:22 +0800 Message-ID: <20231110033324.2455523-6-wangkefeng.wang@huawei.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20231110033324.2455523-1-wangkefeng.wang@huawei.com> References: <20231110033324.2455523-1-wangkefeng.wang@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.112.125] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To dggpemm100001.china.huawei.com (7.185.36.93) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Thu, 09 Nov 2023 19:34:43 -0800 (PST) X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782146439321034360 X-GMAIL-MSGID: 1782146439321034360 Replace seven implicit calls to compound_head() with one page_folio(). Signed-off-by: Kefeng Wang --- fs/proc/task_mmu.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c index 51e0ec658457..fe15f99a4908 100644 --- a/fs/proc/task_mmu.c +++ b/fs/proc/task_mmu.c @@ -445,23 +445,25 @@ static void smaps_account(struct mem_size_stats *mss, struct page *page, { int i, nr = compound ? compound_nr(page) : 1; unsigned long size = nr * PAGE_SIZE; + struct folio *folio = page_folio(page); /* * First accumulate quantities that depend only on |size| and the type * of the compound page. */ - if (PageAnon(page)) { + if (folio_test_anon(folio)) { mss->anonymous += size; - if (!PageSwapBacked(page) && !dirty && !PageDirty(page)) + if (!folio_test_swapbacked(folio) && !dirty && + !folio_test_dirty(folio)) mss->lazyfree += size; } - if (PageKsm(page)) + if (folio_test_ksm(folio)) mss->ksm += size; mss->resident += size; /* Accumulate the size in pages that have been accessed. */ - if (young || page_is_young(page) || PageReferenced(page)) + if (young || folio_test_young(folio) || folio_test_referenced(folio)) mss->referenced += size; /* @@ -479,7 +481,7 @@ static void smaps_account(struct mem_size_stats *mss, struct page *page, * especially for migration entries. Treat regular migration entries * as mapcount == 1. */ - if ((page_count(page) == 1) || migration) { + if ((folio_ref_count(folio) == 1) || migration) { smaps_page_accumulate(mss, page, size, size << PSS_SHIFT, dirty, locked, true); return; From patchwork Fri Nov 10 03:33:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kefeng Wang X-Patchwork-Id: 163764 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b129:0:b0:403:3b70:6f57 with SMTP id q9csp864714vqs; Thu, 9 Nov 2023 19:34:10 -0800 (PST) X-Google-Smtp-Source: AGHT+IEuKStqooT0jRgpvxaYCgq8juVhmqAeiTrND9J/CTFhiL2wIHxNSZ349u675QVt/kdwN1pz X-Received: by 2002:a17:902:8f96:b0:1cc:6ace:e427 with SMTP id z22-20020a1709028f9600b001cc6acee427mr6943387plo.5.1699587250095; Thu, 09 Nov 2023 19:34:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699587250; cv=none; d=google.com; s=arc-20160816; b=NYSwtZ2bNra9UW/esVdedryfNIuysZQy4khgpJhVqEBJVx9ECnv8J3ImUhLjNBLxxx ykRslmafG1SGTpFv4YPXlPDRyVkTy1U3ct1u1N9qegVrqrB+c4/fsA0XRT7hRiGoQmJu +NWEGiH3ZEzZph9AN65mNzYw09AEbF+JNgRtOMxIE42Z1mAvZ1u2sRmMqH2PXBSy+NkC Ijans+OFYgK5aXzXhYhO8t5zKEv+1rQyVJu5QUpW7g4Y7doKqfrNJx0MGg496Bk6yiwz WeBYlheOL6UuwidxIKw/Y1fapZtj/Twz1GjqrvwlkZN6KwgsaLjZnnokROn15UQ+FXFy g1KQ== 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=yLmVQ9KLbgFtHt55SBzSQPM0B7D9zMqtHQVIyqdaEig=; fh=Ig0AqGQMuH358nWWGrnHSF2kv4xbMV1Ws+OHgkmQS6g=; b=HLNF1aZwP+xOFUBeWHUfqUQIIooYDUezSpr24gLhtduucmhBNYJp9f2Pouo+TKY8GP api6U3FQ/Utv6kUwmXSCnslYke/sUT1wMhJfT4YJuF3obIjeOGVgvn3JyaGXsD3q3CM8 lIT9IW42gWvT+IySq9T0pjqhyO9gY3XBiUa5ai0fweXmmEXXc9uf7ECKLsnVK/ARUUbN tsZm1XfQmG7rtIUCnYRtuDFYwFnS8XHnQcDUV8vmox/I4sebsRl7WkpomNO39+HQNJFa Ul/I8ahhSRot5/2d35TylZLpjqrelTSOfnXOOor34CN3gBcqctcFaj66WLzyDLgnenbI Qm8Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id t18-20020a1709028c9200b001cc18133022si6050706plo.285.2023.11.09.19.34.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Nov 2023 19:34:10 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 2F78983B4583; Thu, 9 Nov 2023 19:34:09 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345836AbjKJDeB (ORCPT + 30 others); Thu, 9 Nov 2023 22:34:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37744 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345805AbjKJDdy (ORCPT ); Thu, 9 Nov 2023 22:33:54 -0500 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 78D354682 for ; Thu, 9 Nov 2023 19:33:52 -0800 (PST) Received: from dggpemm100001.china.huawei.com (unknown [172.30.72.57]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4SRPYW5dvJzWhCv; Fri, 10 Nov 2023 11:33:35 +0800 (CST) Received: from localhost.localdomain (10.175.112.125) by dggpemm100001.china.huawei.com (7.185.36.93) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Fri, 10 Nov 2023 11:33:50 +0800 From: Kefeng Wang To: Andrew Morton CC: , , Matthew Wilcox , David Hildenbrand , Gregory Price , Kefeng Wang Subject: [PATCH v2 6/7] mm: task_mmu: use a folio in clear_refs_pte_range() Date: Fri, 10 Nov 2023 11:33:23 +0800 Message-ID: <20231110033324.2455523-7-wangkefeng.wang@huawei.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20231110033324.2455523-1-wangkefeng.wang@huawei.com> References: <20231110033324.2455523-1-wangkefeng.wang@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.112.125] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To dggpemm100001.china.huawei.com (7.185.36.93) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Thu, 09 Nov 2023 19:34:09 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782146399938822238 X-GMAIL-MSGID: 1782146399938822238 Use a folio to save two compound_head() calls in clear_refs_pte_range(). Signed-off-by: Kefeng Wang --- fs/proc/task_mmu.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c index fe15f99a4908..740d5c4fa33c 100644 --- a/fs/proc/task_mmu.c +++ b/fs/proc/task_mmu.c @@ -1161,7 +1161,7 @@ static int clear_refs_pte_range(pmd_t *pmd, unsigned long addr, struct vm_area_struct *vma = walk->vma; pte_t *pte, ptent; spinlock_t *ptl; - struct page *page; + struct folio *folio; ptl = pmd_trans_huge_lock(pmd, vma); if (ptl) { @@ -1173,12 +1173,12 @@ static int clear_refs_pte_range(pmd_t *pmd, unsigned long addr, if (!pmd_present(*pmd)) goto out; - page = pmd_page(*pmd); + folio = page_folio(pmd_page(*pmd)); /* Clear accessed and referenced bits. */ pmdp_test_and_clear_young(vma, addr, pmd); - test_and_clear_page_young(page); - ClearPageReferenced(page); + folio_test_clear_young(folio); + folio_clear_referenced(folio); out: spin_unlock(ptl); return 0; @@ -1200,14 +1200,14 @@ static int clear_refs_pte_range(pmd_t *pmd, unsigned long addr, if (!pte_present(ptent)) continue; - page = vm_normal_page(vma, addr, ptent); - if (!page) + folio = vm_normal_folio(vma, addr, ptent); + if (!folio) continue; /* Clear accessed and referenced bits. */ ptep_test_and_clear_young(vma, addr, pte); - test_and_clear_page_young(page); - ClearPageReferenced(page); + folio_test_clear_young(folio); + folio_clear_referenced(folio); } pte_unmap_unlock(pte - 1, ptl); cond_resched(); From patchwork Fri Nov 10 03:33:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kefeng Wang X-Patchwork-Id: 163768 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b129:0:b0:403:3b70:6f57 with SMTP id q9csp864954vqs; Thu, 9 Nov 2023 19:34:46 -0800 (PST) X-Google-Smtp-Source: AGHT+IH8DhMj2nbs/UarpAOaO4Ee5liWNjS++EBUpx3pEzVip/znLaTxPvFDY0xFgkjzWWfC7iUS X-Received: by 2002:a17:902:e844:b0:1ca:29f:4b06 with SMTP id t4-20020a170902e84400b001ca029f4b06mr7253833plg.2.1699587286665; Thu, 09 Nov 2023 19:34:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699587286; cv=none; d=google.com; s=arc-20160816; b=eKy3YHTgFaOgH7QTWSQ4MyRX6o5rR9+nTEwVSLxsd+/QR7YUz/G2/6TuVT92WjsYeT 9rBWzydmkQ9UHAjqnZSAA5pcEB6oxq+botRgnmlsCQlU/e3Y6+Mx3TdFL8w3Nl0A1vkO rVA0E/HSFhm8VuJecNsu4Fqh+afuTtf8gUgQFhPPFxg3jwfPvoVTQhT4pNzItV8uz9EN +Gpqe2i/0L3iMcW7UDTV1gjXZrL9z1hGfSaBMmCvzvxJFSsZE+wZ8/BCSoTHU9m4W6W1 QFGDKqENAqHbxnsaLZewbrTsPMwc3ratl61ClfHX2jb1qW3qSEIUhWv0TRIyi1WnXEjp rcDQ== 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=5eAPoCyw7ST93JlrloiSVZ/yrBLsJoeWkbzc0p5ovyE=; fh=Ig0AqGQMuH358nWWGrnHSF2kv4xbMV1Ws+OHgkmQS6g=; b=uQd/esYSoNuyACwdeb4B59BwEm8XfdzV6HOZTQM15KQtCvUlBQKfZxje7izpA6CGpG EEj0p90ULW9wWO0xFuu/DKslCRaDaXTbqoLWQbGJzOqV/5eZK0gCRU/PNxoE5y/MJRh5 PHbfKsCXkwLO+Z5+pAMfyW5oZlhmofM1XTghoJRYH+ugoExgwm3AQyboXPeNct6feMuo jW36RVof4LE0Iv51LgJ3FgiXzFOlUxShCMp7in6iQGY7TUelS7XjsBpT7/L8EJkihnU1 Umhn21qzBjAYMLyrbb/gs/EuYlnsxqoM8YQ1j/MTSx6pOYhNlLAKLrykAhFfsj6ZigLb 4GsQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 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 fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id j15-20020a170903024f00b001c342073f76si6815113plh.323.2023.11.09.19.34.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Nov 2023 19:34:46 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 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 (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id E2916834A771; Thu, 9 Nov 2023 19:34:39 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345866AbjKJDeH (ORCPT + 30 others); Thu, 9 Nov 2023 22:34:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37744 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345813AbjKJDdz (ORCPT ); Thu, 9 Nov 2023 22:33:55 -0500 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CBB8744BD for ; Thu, 9 Nov 2023 19:33:52 -0800 (PST) Received: from dggpemm100001.china.huawei.com (unknown [172.30.72.57]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4SRPV55pKYzmXKR; Fri, 10 Nov 2023 11:30:37 +0800 (CST) Received: from localhost.localdomain (10.175.112.125) by dggpemm100001.china.huawei.com (7.185.36.93) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Fri, 10 Nov 2023 11:33:50 +0800 From: Kefeng Wang To: Andrew Morton CC: , , Matthew Wilcox , David Hildenbrand , Gregory Price , Kefeng Wang Subject: [PATCH v2 7/7] page_idle: kill page idle and young wrapper Date: Fri, 10 Nov 2023 11:33:24 +0800 Message-ID: <20231110033324.2455523-8-wangkefeng.wang@huawei.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20231110033324.2455523-1-wangkefeng.wang@huawei.com> References: <20231110033324.2455523-1-wangkefeng.wang@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.112.125] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To dggpemm100001.china.huawei.com (7.185.36.93) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Thu, 09 Nov 2023 19:34:39 -0800 (PST) X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782146438859590999 X-GMAIL-MSGID: 1782146438859590999 Since all the calls of page idle and young functions are gone, let's remove all the wrapper. Signed-off-by: Kefeng Wang --- include/linux/page_idle.h | 25 ------------------------- 1 file changed, 25 deletions(-) diff --git a/include/linux/page_idle.h b/include/linux/page_idle.h index d8f344840643..1168d5f58ff2 100644 --- a/include/linux/page_idle.h +++ b/include/linux/page_idle.h @@ -119,29 +119,4 @@ static inline void folio_clear_idle(struct folio *folio) } #endif /* CONFIG_PAGE_IDLE_FLAG */ - -static inline bool page_is_young(struct page *page) -{ - return folio_test_young(page_folio(page)); -} - -static inline void set_page_young(struct page *page) -{ - folio_set_young(page_folio(page)); -} - -static inline bool test_and_clear_page_young(struct page *page) -{ - return folio_test_clear_young(page_folio(page)); -} - -static inline bool page_is_idle(struct page *page) -{ - return folio_test_idle(page_folio(page)); -} - -static inline void set_page_idle(struct page *page) -{ - folio_set_idle(page_folio(page)); -} #endif /* _LINUX_MM_PAGE_IDLE_H */