Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp769823ybh; Wed, 11 Mar 2020 10:25:31 -0700 (PDT) X-Google-Smtp-Source: ADFU+vsNstg2i+u8vF1C3kMVCmSvhsny9V42bhrqmQYVu+h/JwH6V/XNvQmPpsgA6lecx6u4OwvE X-Received: by 2002:a9d:7e8b:: with SMTP id m11mr3235799otp.83.1583947531159; Wed, 11 Mar 2020 10:25:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1583947531; cv=none; d=google.com; s=arc-20160816; b=eKZjdJUNdzyrSsRJ0s0b6J9JzKf8TF0dAUsMIyI0GEQRV6L/vuqdEea8hDo9OsCEJn tbtuoiBlgMpcj9J7X4QFotTL6ovzGPUyLdiBSY7BYamTHhgqeRXvbs8P3RwZ4eKdNawz ln37tElb1E6nTbHUm1ndbP2EXlNj/jPHjb83j26lH4cSnDwDSQEAM5plwbmLKASs9KSq skTVN2M90156YU+S+T+yaW/sMDlIHRqyJNB98wWsT+T34pcYwRWvkepaIIgkYW7P5ePq iz2nHTnYQAtz4KLIyV8A4eikGApWYE4rhHgmzv2BFBT2Uv0S2aMYuGXf7+0r5YB1copg rrQQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=v2s2gpTFE86HMUCtfG+3hFSRbUd6dz2EKqK5OdS4qO0=; b=Gee2VDtIMpPVLUTrSKHeA2nMoycInSKfHPL1BTI9pGYD0vlohfKrZ30m0J8Z82RH2F Ji0JMOZdVL3nhfnJmv95wkw2pjWQkeaUpDVeWuhZSG8rhTZJEm4k3DHniKtsqpySPhGP TRquFLrGQ6LH0PFrxS+B278BsuGAxv61Rd8bbiQhX6FPJMNq+ePVN4e3pcyGSR3T+KvP pJDd9iUxfKxtNbDpSHCTCGEuUJ46yGxaxE72vPSihh+oeIgcoNH/Yp5BH/EzUJkWXzKG YAMYhynYv/fWAkn4+cEkOL/nxhFR3m1Xi2ih0ynVEBX/MoxXjpZVKilqTl0JPPh0WXTh /ZTw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k193si287831oih.78.2020.03.11.10.25.19; Wed, 11 Mar 2020 10:25:31 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730441AbgCKRY7 (ORCPT + 99 others); Wed, 11 Mar 2020 13:24:59 -0400 Received: from mx2.suse.de ([195.135.220.15]:48876 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730366AbgCKRY7 (ORCPT ); Wed, 11 Mar 2020 13:24:59 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 4E24BABD7; Wed, 11 Mar 2020 17:24:57 +0000 (UTC) From: Vlastimil Babka To: Mike Kravetz , Andrew Morton Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Vlastimil Babka , "Kirill A . Shutemov" Subject: [PATCH] mm/hugetlb: remove unnecessary memory fetch in PageHeadHuge() Date: Wed, 11 Mar 2020 18:24:40 +0100 Message-Id: <20200311172440.6988-1-vbabka@suse.cz> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit f1e61557f023 ("mm: pack compound_dtor and compound_order into one word in struct page") changed compound_dtor from a pointer to an array index in order to pack it. To check if page has the hugeltbfs compound_dtor, we can just compare the index directly without fetching the function pointer. Said commit did that with PageHuge() and we can do the same with PageHeadHuge() to make the code a bit smaller and faster. Signed-off-by: Vlastimil Babka Cc: Mike Kravetz Cc: Kirill A. Shutemov --- mm/hugetlb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/hugetlb.c b/mm/hugetlb.c index dd8737a94bec..ba1ca452aa7f 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -1313,7 +1313,7 @@ int PageHeadHuge(struct page *page_head) if (!PageHead(page_head)) return 0; - return get_compound_page_dtor(page_head) == free_huge_page; + return page_head[1].compound_dtor == HUGETLB_PAGE_DTOR; } pgoff_t __basepage_index(struct page *page) -- 2.25.1