From patchwork Tue Oct 12 18:01:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Weiner X-Patchwork-Id: 12553427 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 54816C433F5 for ; Tue, 12 Oct 2021 18:02:13 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 0D434610C9 for ; Tue, 12 Oct 2021 18:02:13 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 0D434610C9 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=cmpxchg.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 1F04C94000E; Tue, 12 Oct 2021 14:02:01 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 14BDD940007; Tue, 12 Oct 2021 14:02:01 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id F069494000E; Tue, 12 Oct 2021 14:02:00 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0245.hostedemail.com [216.40.44.245]) by kanga.kvack.org (Postfix) with ESMTP id DCCB2940007 for ; Tue, 12 Oct 2021 14:02:00 -0400 (EDT) Received: from smtpin08.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id A29DB1838F83E for ; Tue, 12 Oct 2021 18:02:00 +0000 (UTC) X-FDA: 78688554000.08.175E115 Received: from mail-qk1-f179.google.com (mail-qk1-f179.google.com [209.85.222.179]) by imf21.hostedemail.com (Postfix) with ESMTP id 51265D035A60 for ; Tue, 12 Oct 2021 18:02:00 +0000 (UTC) Received: by mail-qk1-f179.google.com with SMTP id r15so12015468qkp.8 for ; Tue, 12 Oct 2021 11:02:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg-org.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=II+k1bERRgejUzmo9A3RKta99347TW8VHEIFP/mwtwE=; b=QcbIN7EkYNq6duRE+TluPBPUoFAfrstVRWNKeU8/xHunVY2sJpjcRkudHjbdT+pyxS ZwzDNYTsoPYxsAZKWf79iepWQUvL9lR67DdpvvuoL9wTvqiBwXyskfCNRk6Z0+q7LAN3 RyM1ovet4u4Jd8bv7NVZKmZxR+qHPGVX6D2UTrgu09vkY/wFfVkssEPY7HHBd5FCRWne EbRu9qvRCOHdtbB9Z+YefmyMxM7GZbsGjRXM3MmDmZnYg+XYYMx4gqAJJyIGRS1J/ZBL B5WSIa+SMX52bUfI36yPJji10ZAZxvpGpOuSGyI2i7BQ768SJ1mX8+aifvQRoBNcPHf0 giGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=II+k1bERRgejUzmo9A3RKta99347TW8VHEIFP/mwtwE=; b=6pa9zhrWLXXi4SSwhj/V0X7+GERvNzL31kAdmSP5pQRt2Ec131V2DqvzyfDwJJieBW dZmWl1qZ8V/xg7/8VxNXtfjo6l9LHMTE+sruJx67YCTdOr1guxPUWKyDJ/GjGe4Izt2m 4OVnxxFxavwlDMeELuS7fnQyVwkXOtpwy/ogqoYsCuc4smvAFTj/OZpnvBin+OYdhjdo ZBxASf/zgQzhDobOvXK2W4wqtDDx5ZU2wOdOVUh65lUw/PPReyKU5ullqpbWd3l2uSA8 DzOZq35ELDpe7vhn6xjbaaZtOjusD+Jnye9vaHbcrF831jzw851uvMlrKwNcoV2vtXx/ 8Huw== X-Gm-Message-State: AOAM533qu0eO+xxbdVXy10kboGmFeuOmjbVoPayqY8zrshlRJX7+B9ck /rT1XClGx9C+7123YF/P77txDTBCbBHKAw== X-Google-Smtp-Source: ABdhPJxtS3LWPGdPrw8j47cnxN2+xJsYFJyJ6FYuzADbfbBoVrm6CrU69C5MuqoTyUGlQPtBghN5Hw== X-Received: by 2002:a37:4593:: with SMTP id s141mr20569385qka.368.1634061719532; Tue, 12 Oct 2021 11:01:59 -0700 (PDT) Received: from localhost (cpe-98-15-154-102.hvc.res.rr.com. [98.15.154.102]) by smtp.gmail.com with ESMTPSA id b8sm1927583qtr.82.2021.10.12.11.01.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Oct 2021 11:01:59 -0700 (PDT) From: Johannes Weiner To: linux-mm@kvack.org Cc: Matthew Wilcox , Kent Overstreet , "Kirill A. Shutemov" , Vlastimil Babka , Michal Hocko , Roman Gushchin , linux-kernel@vger.kernel.org, kernel-team@fb.com Subject: [PATCH 08/11] PageSlab: eliminate unnecessary compound_head() calls in mm/slab_common Date: Tue, 12 Oct 2021 14:01:45 -0400 Message-Id: <20211012180148.1669685-9-hannes@cmpxchg.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20211012180148.1669685-1-hannes@cmpxchg.org> References: <20211012180148.1669685-1-hannes@cmpxchg.org> MIME-Version: 1.0 X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 51265D035A60 X-Stat-Signature: ceouqt6p81zfg1gsk85t3qhj91djxz94 Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=cmpxchg-org.20210112.gappssmtp.com header.s=20210112 header.b=QcbIN7Ek; dmarc=pass (policy=none) header.from=cmpxchg.org; spf=pass (imf21.hostedemail.com: domain of hannes@cmpxchg.org designates 209.85.222.179 as permitted sender) smtp.mailfrom=hannes@cmpxchg.org X-HE-Tag: 1634061720-547507 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: virt_to_head_page() implies it. Signed-off-by: Johannes Weiner --- 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; }