Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp6537400rwi; Mon, 24 Oct 2022 02:47:50 -0700 (PDT) X-Google-Smtp-Source: AMsMyM57gkTR7ARhvKLqny7BkiEuKyuUZAii8eHfNzWah0zY8Eh15rMj4tyrq597E0sdn2XUo9mK X-Received: by 2002:a17:90b:2741:b0:20a:ebc3:6513 with SMTP id qi1-20020a17090b274100b0020aebc36513mr38418313pjb.29.1666604870240; Mon, 24 Oct 2022 02:47:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666604870; cv=none; d=google.com; s=arc-20160816; b=KTmHz6y67VCAW5FPcxDWz5O5xTmd1IarXMMOGID+zc7mdRx6bHDRnLu2bXYgdw71NZ OvnEsyHb5IqTFWime1ou9sdhiOIwkFsXerl3hn4UiPuCt+COLJkbpfMZ/Wzs62bQ+bAt 5EPJb4WMJHG3pCCqMx6lzke5ardnGLdNXhQlVDWQVlE5OCYiOHWxkMYBMj5W5Y7IoWxV zg87dHcUoISR/IF/L7Ygz/yfzXUpWKs9cwTVr/i6Xcfoim/VuAMpJPK6GMnGfBFwg8hQ u/pzcLF8Mhld+u8u82LqdE72MBBgponSg3YXGQKOrT1/lyfq/e+CiOLM75BYTKlq4RK6 HuaQ== 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=OciWBnMB1C06hCEgHQ+7iXgI8Hy5aFrbKEv0CT4cNls=; b=WOcv3VFcSY+/dfVkgKrZc4kduPzOtZHoh+kukk87DvWxWVpT9bAs7OGOkNrQsyEtYq tph0VB/xofYgPYu9o0kC0asp/ZFJD2rMAaSy9SRfy4URKFo7oGC+ifvtDzJmRODlxomS BC0kJjwF7XGAi68VPZqpTCb6YJD788JrRIiiB9o6wHGhuCZTcoWZnFpvLrSWD8XstlXE AGEjQ/hsKoKu1TOMTqFNrktKDEYag3hLh3Jx5hzIJcnguUJ6DVFRtMGDSNq0r2k/uROU c+AVTAnY8qI7BGsCiqjNW9GYyLzv7SwsdD0svtaHJJx+u7HhXW8Re4ggqS1adENP76cj vYHw== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 191-20020a6302c8000000b0046ecbfda052si9821872pgc.389.2022.10.24.02.47.38; Mon, 24 Oct 2022 02:47:50 -0700 (PDT) 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 S229915AbiJXJV5 (ORCPT + 99 others); Mon, 24 Oct 2022 05:21:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51210 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229816AbiJXJVt (ORCPT ); Mon, 24 Oct 2022 05:21:49 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DC86F4F1BE for ; Mon, 24 Oct 2022 02:21:47 -0700 (PDT) Received: from dggemv704-chm.china.huawei.com (unknown [172.30.72.54]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4MwqFy2TK7zmVJf; Mon, 24 Oct 2022 17:16:54 +0800 (CST) Received: from kwepemm600017.china.huawei.com (7.193.23.234) by dggemv704-chm.china.huawei.com (10.3.19.47) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Mon, 24 Oct 2022 17:21:44 +0800 Received: from localhost.localdomain (10.175.112.125) by kwepemm600017.china.huawei.com (7.193.23.234) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Mon, 24 Oct 2022 17:21:43 +0800 From: Tong Tiangen To: Paul Walmsley , Palmer Dabbelt , Albert Ou CC: , , "Tong Tiangen" , , Guohanjun Subject: [PATCH -next 2/2] riscv/mm: add arch hook arch_clear_hugepage_flags Date: Mon, 24 Oct 2022 09:47:25 +0000 Message-ID: <20221024094725.3054311-3-tongtiangen@huawei.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221024094725.3054311-1-tongtiangen@huawei.com> References: <20221024094725.3054311-1-tongtiangen@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.112.125] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To kwepemm600017.china.huawei.com (7.193.23.234) 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 With the PG_arch_1 we keep track if the page's data cache is clean, architecture rely on this property to treat new pages as dirty with respect to the data cache and perform the flushing before mapping the pages into userspace. This patch adds a new architecture hook, arch_clear_hugepage_flags,so that architectures which rely on the page flags being in a particular state for fresh allocations can adjust the flags accordingly when a page is freed into the pool. Fixes: 9e953cda5cdf ("riscv: Introduce huge page support for 32/64bit kernel") Signed-off-by: Tong Tiangen --- arch/riscv/include/asm/hugetlb.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/arch/riscv/include/asm/hugetlb.h b/arch/riscv/include/asm/hugetlb.h index a5c2ca1d1cd8..ec19d6afc896 100644 --- a/arch/riscv/include/asm/hugetlb.h +++ b/arch/riscv/include/asm/hugetlb.h @@ -5,4 +5,10 @@ #include #include +static inline void arch_clear_hugepage_flags(struct page *page) +{ + clear_bit(PG_dcache_clean, &page->flags); +} +#define arch_clear_hugepage_flags arch_clear_hugepage_flags + #endif /* _ASM_RISCV_HUGETLB_H */ -- 2.25.1