lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20211012180148.1669685-9-hannes@cmpxchg.org>
Date:   Tue, 12 Oct 2021 14:01:45 -0400
From:   Johannes Weiner <hannes@...xchg.org>
To:     linux-mm@...ck.org
Cc:     Matthew Wilcox <willy@...radead.org>,
        Kent Overstreet <kent.overstreet@...il.com>,
        "Kirill A. Shutemov" <kirill@...temov.name>,
        Vlastimil Babka <vbabka@...e.cz>,
        Michal Hocko <mhocko@...e.com>, Roman Gushchin <guro@...com>,
        linux-kernel@...r.kernel.org, kernel-team@...com
Subject: [PATCH 08/11] PageSlab: eliminate unnecessary compound_head() calls in mm/slab_common

virt_to_head_page() implies it.

Signed-off-by: Johannes Weiner <hannes@...xchg.org>
---
 mm/slab.h        | 3 +--
 mm/slab_common.c | 4 ++--
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/mm/slab.h b/mm/slab.h
index 0446948c9c4e..4bcaa08320e6 100644
--- a/mm/slab.h
+++ b/mm/slab.h
@@ -410,8 +410,7 @@ static inline struct kmem_cache *virt_to_cache(const void *obj)
 	struct page *page;
 
 	page = virt_to_head_page(obj);
-	if (WARN_ONCE(!PageSlab(compound_head(page)),
-		      "%s: Object is not a Slab page!\n",
+	if (WARN_ONCE(!PageSlab(page), "%s: Object is not a Slab page!\n",
 		      __func__))
 		return NULL;
 	return page->slab_cache;
diff --git a/mm/slab_common.c b/mm/slab_common.c
index 5f7063797f0e..ec2bb0beed75 100644
--- a/mm/slab_common.c
+++ b/mm/slab_common.c
@@ -564,7 +564,7 @@ bool kmem_valid_obj(void *object)
 	if (object < (void *)PAGE_SIZE || !virt_addr_valid(object))
 		return false;
 	page = virt_to_head_page(object);
-	return PageSlab(compound_head(page));
+	return PageSlab(page);
 }
 EXPORT_SYMBOL_GPL(kmem_valid_obj);
 
@@ -594,7 +594,7 @@ void kmem_dump_obj(void *object)
 	if (WARN_ON_ONCE(!virt_addr_valid(object)))
 		return;
 	page = virt_to_head_page(object);
-	if (WARN_ON_ONCE(!PageSlab(compound_head(page)))) {
+	if (WARN_ON_ONCE(!PageSlab(page))) {
 		pr_cont(" non-slab memory.\n");
 		return;
 	}
-- 
2.32.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ