From patchwork Tue Oct 12 18:01:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Weiner X-Patchwork-Id: 12553429 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 C08BAC433F5 for ; Tue, 12 Oct 2021 18:02:15 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 753EB610E7 for ; Tue, 12 Oct 2021 18:02:15 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 753EB610E7 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 DAA8494000F; Tue, 12 Oct 2021 14:02:01 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D57C0940007; 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 BF80394000F; Tue, 12 Oct 2021 14:02:01 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0230.hostedemail.com [216.40.44.230]) by kanga.kvack.org (Postfix) with ESMTP id AE4BD940007 for ; Tue, 12 Oct 2021 14:02:01 -0400 (EDT) Received: from smtpin29.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 6ABD0183BCDA0 for ; Tue, 12 Oct 2021 18:02:01 +0000 (UTC) X-FDA: 78688554042.29.48D9189 Received: from mail-qk1-f176.google.com (mail-qk1-f176.google.com [209.85.222.176]) by imf06.hostedemail.com (Postfix) with ESMTP id 1219C801A89C for ; Tue, 12 Oct 2021 18:02:00 +0000 (UTC) Received: by mail-qk1-f176.google.com with SMTP id z40so18804661qko.7 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=EJleHbVtWFR6gqUGI4pMK3bP4aI2cTYgy4hO4rU19aY=; b=SzHk97+39EXkttB7Lcw0JFRnbjxuOzQa4QMcS+7Pnak9LUL8400Ch6IeQEO4X9RQYC SmUsHsHiEjQqsphLd2x9Jh3Y1GZBSxR57bLxQ93NhuCHeuPz5C8HlCXC/KAUylUm4jPG uJhs+iEHiloK/6bKOXSgO0ii+g4sdLCzkrSeh+a6LChSoa2c/Hv+oSChwRKqcNzb+wqF otALpvGvHBEq27rFOqPBpe+d1Wu68gC15DM+a/UgIfnIyLe0WpcAEUZLJBE63nD9EyZE ++nx+P0QcnjPPMhsIAYtUYtpvgmV+bwzHTtLCD9ds4ZI5yTFDjT7Mi0BQzG1w473Im5P MSOQ== 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=EJleHbVtWFR6gqUGI4pMK3bP4aI2cTYgy4hO4rU19aY=; b=tyH9G3hQcwk5w170mv0GVmT+LS7hWRhe18+kYKagrmM8r+WYF4JX5OFVxOMgIvxrll u3tKfHLfTcYKBXR0Scp10AXgwBE0z1x9w7QfiM5HoGrcqnIW1BBZCrup+nAwUB/NEKWw Myy8ezaMvRwV6eXPaKh3431Eqe6pG88udf4ed7ddFwgpoc/qVbhzSDrZb4LFD72fSyLr MuBGcjC8Ol2GWsim0SuNJzZp+liE6AaFSajdznfh3jBVPsDf+nq8fE3o8tT9KAujJ2cy J3BCPWIOJVOGRITNFA59HZWRJ5S7p5fzyo36/q4cY63AEtethIQxDaNnfvkZdY3KS11V XgRg== X-Gm-Message-State: AOAM533CjXhEhmW7W5b7yhOEJmoLC6vlbmdMIkuIUNUrgq8e9l77BwNt RbJy9RfeEYPQ1H6Vli5bsrkRrk4cMPjPLg== X-Google-Smtp-Source: ABdhPJyTqn/1OfEZHmHubXFqDcHcCvvI6aiY+JnAN16rKv0iWgpmjvHcrtWJma04shZz9kCbKhhbWg== X-Received: by 2002:ae9:de84:: with SMTP id s126mr21370083qkf.350.1634061720380; Tue, 12 Oct 2021 11:02:00 -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 t9sm7261733qtx.47.2021.10.12.11.02.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Oct 2021 11:02:00 -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 09/11] PageSlab: eliminate unnecessary compound_head() calls in mm/slub Date: Tue, 12 Oct 2021 14:01:46 -0400 Message-Id: <20211012180148.1669685-10-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-Queue-Id: 1219C801A89C X-Stat-Signature: rha38wmzne9zdmjmajxbo68cqqu8npax Authentication-Results: imf06.hostedemail.com; dkim=pass header.d=cmpxchg-org.20210112.gappssmtp.com header.s=20210112 header.b=SzHk97+3; spf=pass (imf06.hostedemail.com: domain of hannes@cmpxchg.org designates 209.85.222.176 as permitted sender) smtp.mailfrom=hannes@cmpxchg.org; dmarc=pass (policy=none) header.from=cmpxchg.org X-Rspamd-Server: rspam06 X-HE-Tag: 1634061720-362790 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/slub.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mm/slub.c b/mm/slub.c index 37a4cc1e73a7..d1bd004c8c2f 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -3554,7 +3554,7 @@ int build_detached_freelist(struct kmem_cache *s, size_t size, page = virt_to_head_page(object); if (!s) { /* Handle kalloc'ed objects */ - if (unlikely(!PageSlab(compound_head(page)))) { + if (unlikely(!PageSlab(page))) { free_nonslab_page(page, object); p[size] = NULL; /* mark object processed */ return size; @@ -4516,7 +4516,7 @@ size_t __ksize(const void *object) page = virt_to_head_page(object); - if (unlikely(!PageSlab(compound_head(page)))) { + if (unlikely(!PageSlab(page))) { WARN_ON(!PageCompound(page)); return page_size(page); } @@ -4536,7 +4536,7 @@ void kfree(const void *x) return; page = virt_to_head_page(x); - if (unlikely(!PageSlab(compound_head(page)))) { + if (unlikely(!PageSlab(page))) { free_nonslab_page(page, object); return; }