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;