From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.0 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6F82DC433DF for ; Fri, 3 Jul 2020 15:37:42 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 3160721534 for ; Fri, 3 Jul 2020 15:37:42 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3160721534 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 916988D0075; Fri, 3 Jul 2020 11:37:41 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 87A938D0074; Fri, 3 Jul 2020 11:37:41 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 719D58D0075; Fri, 3 Jul 2020 11:37:41 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0147.hostedemail.com [216.40.44.147]) by kanga.kvack.org (Postfix) with ESMTP id 51DF18D0074 for ; Fri, 3 Jul 2020 11:37:41 -0400 (EDT) Received: from smtpin26.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 18B63181AC9BF for ; Fri, 3 Jul 2020 15:37:41 +0000 (UTC) X-FDA: 76997169522.26.pie61_191614026e93 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin26.hostedemail.com (Postfix) with ESMTP id DB8551804A301 for ; Fri, 3 Jul 2020 15:37:40 +0000 (UTC) X-HE-Tag: pie61_191614026e93 X-Filterd-Recvd-Size: 3135 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf38.hostedemail.com (Postfix) with ESMTP for ; Fri, 3 Jul 2020 15:37:40 +0000 (UTC) Received: from localhost.localdomain (unknown [95.146.230.158]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 8A13B217BA; Fri, 3 Jul 2020 15:37:37 +0000 (UTC) From: Catalin Marinas To: linux-arm-kernel@lists.infradead.org Cc: linux-mm@kvack.org, linux-arch@vger.kernel.org, Will Deacon , Dave P Martin , Vincenzo Frascino , Szabolcs Nagy , Kevin Brodsky , Andrey Konovalov , Peter Collingbourne , Andrew Morton Subject: [PATCH v6 07/26] mm: Preserve the PG_arch_* flags in __split_huge_page_tail() Date: Fri, 3 Jul 2020 16:36:59 +0100 Message-Id: <20200703153718.16973-8-catalin.marinas@arm.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200703153718.16973-1-catalin.marinas@arm.com> References: <20200703153718.16973-1-catalin.marinas@arm.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: DB8551804A301 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam04 Content-Transfer-Encoding: quoted-printable 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: When a huge page is split into normal pages, part of the head page flags are transferred to the tail pages. However, the PG_arch_* flags are not part of the preserved set. PG_arch_1 is currently used by the arch code to handle cache maintenance for user space (either for I-D cache coherency or for D-cache aliases consistent with the kernel mapping). Since splitting a huge page does not change the physical or virtual address of a mapping, additional cache maintenance for the tail pages is unnecessary. Preserving the PG_arch_1 flag from the head page in the tail pages would not break the current use-cases. PG_arch_2 is currently used for arm64 MTE support to mark pages that have valid tags. The absence of such flag causes the arm64 set_pte_at() to clear the tags in order to avoid stale tags exposed to user or the swapping out hooks to ignore the tags. Not preserving PG_arch_2 on huge page splitting leads to tag corruption in the tail pages. To avoid the above and for consistency between the two PG_arch_* flags, preserve both PG_arch_1 and PG_arch_2 in __split_huge_page_tail(). Signed-off-by: Catalin Marinas Cc: Andrew Morton --- Notes: New in v6. mm/huge_memory.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/mm/huge_memory.c b/mm/huge_memory.c index 78c84bee7e29..22b3236a6dd8 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -2364,6 +2364,10 @@ static void __split_huge_page_tail(struct page *he= ad, int tail, (1L << PG_workingset) | (1L << PG_locked) | (1L << PG_unevictable) | + (1L << PG_arch_1) | +#ifdef CONFIG_64BIT + (1L << PG_arch_2) | +#endif (1L << PG_dirty))); =20 /* ->mapping in first tail page is compound_mapcount */