Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 46264BA46 for ; Sat, 29 Jun 2024 02:30:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719628231; cv=none; b=fvQpFUSnJaafijhSfi/5qU8KeTDlt0FcxB1BA1KGU4Kp/rbcEznYTwxl1V7gAsPF0bVnlR/5PoZg+M0BEDMdlEFjdEvLASdJBk34YKbG6NuBzqcCFSlEQkXGpTRzpEEmCh5D34KVwzAr9MTU7RHKhwEpp6jl8cMFGtFY36aFMGo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719628231; c=relaxed/simple; bh=+jgF3RIgm5CfLbamsCCnjECma5zq59twJPzb53xcL7w=; h=Date:To:From:Subject:Message-Id; b=qQQtWaGvL6WFPVQJ1+KRAq1+h4r7P92+GanKGN1qHA4lryciacb8K9++m1t1OYL1dTjqNCq141ht1K0VpVh3iFm3DlYZbIHXMZuz0CIcPPa+v3w6fvr/lgD6zk3rp/sh7BkHw6BtsIlTq3zusM4Uxo6lSdFUCJuHZmP4XUr3xMc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b=iNVPdN54; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b="iNVPdN54" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1346EC32781; Sat, 29 Jun 2024 02:30:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1719628231; bh=+jgF3RIgm5CfLbamsCCnjECma5zq59twJPzb53xcL7w=; h=Date:To:From:Subject:From; b=iNVPdN548fxyzwr5sUGMd2li9K27eF31yVx5EFxpiJV6hodX+TEbuVAFXgD8Dp3wf +vGo1ltwF7vIpXcUSknQ0ONJ4pX9LHnNuGn1aOJpnRvd9WHAMhMsTyXyLl7A3hx5Mb DYCYse8nSlHzW/4ol2EB9MwfaunFm286R+dBnqdw= Date: Fri, 28 Jun 2024 19:30:30 -0700 To: mm-commits@vger.kernel.org,willy@infradead.org,osalvador@suse.de,oliver.sang@intel.com,linmiaohe@huawei.com,david@redhat.com,akpm@linux-foundation.org From: Andrew Morton Subject: [merged mm-stable] mm-read-page_type-using-read_once.patch removed from -mm tree Message-Id: <20240629023031.1346EC32781@smtp.kernel.org> Precedence: bulk X-Mailing-List: mm-commits@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: The quilt patch titled Subject: mm: read page_type using READ_ONCE has been removed from the -mm tree. Its filename was mm-read-page_type-using-read_once.patch This patch was dropped because it was merged into the mm-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm ------------------------------------------------------ From: David Hildenbrand Subject: mm: read page_type using READ_ONCE Date: Fri, 31 May 2024 14:56:16 +0200 KCSAN complains about possible data races: while we check for a page_type -- for example for sanity checks -- we might concurrently modify the mapcount that overlays page_type. Let's use READ_ONCE to avoid load tearing (shouldn't make a difference) and to make KCSAN happy. Likely, we might also want to use WRITE_ONCE for the writer side of page_type, if KCSAN ever complains about that. But we'll not mess with that for now. Note: nothing should really be broken besides wrong KCSAN complaints. The sanity check that triggers this was added in commit 68f0320824fa ("mm/rmap: convert folio_add_file_rmap_range() into folio_add_file_rmap_[pte|ptes|pmd]()"). Even before that similar races likely where possible, ever since we added page_type in commit 6e292b9be7f4 ("mm: split page_type out from _mapcount"). Link: https://lkml.kernel.org/r/20240531125616.2850153-1-david@redhat.com Signed-off-by: David Hildenbrand Reported-by: kernel test robot Closes: https://lore.kernel.org/oe-lkp/202405281431.c46a3be9-lkp@intel.com Reviewed-by: Oscar Salvador Reviewed-by: Miaohe Lin Cc: Matthew Wilcox Signed-off-by: Andrew Morton --- include/linux/page-flags.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) --- a/include/linux/page-flags.h~mm-read-page_type-using-read_once +++ a/include/linux/page-flags.h @@ -955,9 +955,9 @@ enum pagetype { }; #define PageType(page, flag) \ - ((page->page_type & (PAGE_TYPE_BASE | flag)) == PAGE_TYPE_BASE) + ((READ_ONCE(page->page_type) & (PAGE_TYPE_BASE | flag)) == PAGE_TYPE_BASE) #define folio_test_type(folio, flag) \ - ((folio->page.page_type & (PAGE_TYPE_BASE | flag)) == PAGE_TYPE_BASE) + ((READ_ONCE(folio->page.page_type) & (PAGE_TYPE_BASE | flag)) == PAGE_TYPE_BASE) static inline int page_type_has_type(unsigned int page_type) { @@ -966,7 +966,7 @@ static inline int page_type_has_type(uns static inline int page_has_type(const struct page *page) { - return page_type_has_type(page->page_type); + return page_type_has_type(READ_ONCE(page->page_type)); } #define FOLIO_TYPE_OPS(lname, fname) \ _ Patches currently in -mm which might be from david@redhat.com are