Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp868772ybh; Wed, 11 Mar 2020 12:27:31 -0700 (PDT) X-Google-Smtp-Source: ADFU+vvHTa3qRu6orDZ2ADM8O9wzVXhhuTYAMM9oncXFsIB1Gg7vbPeZCwVtEE3G4KsgG6Q9a7qL X-Received: by 2002:a9d:7458:: with SMTP id p24mr3669787otk.197.1583954850639; Wed, 11 Mar 2020 12:27:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1583954850; cv=none; d=google.com; s=arc-20160816; b=XsYj2Ho9QgbNcF/QwyX1GAwK4guO02OKCz0GtSXtumnvRlyeTTCQfLC84LiBO6Aggx HOun6+mYnu0Fio+LYanf/rrRKMuY1IK0z0sBvXi0Oc1x6MhwSf+fgy2ZVVXeGPJRUZCq oEiUZCwdZKvFZbDrjC7IZJu1huwzvm5h6zrrA6CRR9wxthRBP6qwxzOfaKIgIvChod2r DEVUoKisEdykw34leLmXvROFjgUTUr8IkJNrpiBUK02xTG34+tinZPvb2RrOGp2/FLV+ 86BFYIS3jAZyM1ptlptZGErlCiCsava9zGNHSSfcvVwWni+TzVJByytUmbuCI/FGdJfk aVoA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date:dkim-signature; bh=59QKAlzCo20PiQ6XPvSINe/khVSjSi/vS+Up1F5ddTg=; b=fsVYZqfSSnaJBtGhRlxmOJIJ1X+6s0UkyKLQp5//IY5q0ZKfzLZ2K9sMN/ERe5XrGh pmRk2jX6i5Q+GaS0aBjn3/i5mRoqzLHlyk0xl2oEQmrqD8LOjQF8WqTbtD6hgci23Gav Ht7PwKy8pQmc2fSZrfl19TBiP5Y9HWBN2Jk/z4Tx7wmzzbPb2ONM7e9vlbOSZFnxQNRf om2MS2XHIitR0MfeRAQrKf+4/HGsZvMF8mH0z2D/zAowMZBMrrGMlRNuARWwzdmCI3iW JVgHKxHUOhxSJg/kzfRV43HT9vR4lbqDeOqqyquMz7WdRZxF5Qh/TpdnL9CYFMiOYMoI tIVQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=tJy9S47X; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 45si1615347otu.264.2020.03.11.12.27.17; Wed, 11 Mar 2020 12:27:30 -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; dkim=pass header.i=@google.com header.s=20161025 header.b=tJy9S47X; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731075AbgCKTZZ (ORCPT + 99 others); Wed, 11 Mar 2020 15:25:25 -0400 Received: from mail-pl1-f196.google.com ([209.85.214.196]:37527 "EHLO mail-pl1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730705AbgCKTZY (ORCPT ); Wed, 11 Mar 2020 15:25:24 -0400 Received: by mail-pl1-f196.google.com with SMTP id f16so1550102plj.4 for ; Wed, 11 Mar 2020 12:25:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:in-reply-to:message-id:references :user-agent:mime-version; bh=59QKAlzCo20PiQ6XPvSINe/khVSjSi/vS+Up1F5ddTg=; b=tJy9S47XsErD9oAp5TQAHmEdVwCNzJg333+Gy7Dlv21uAd8nU1x7ZpuifPgBjoculb sGalFcr7RFjYphFG2DvQBkeG0w5ni2bDBdZ4cs9ft/rgRgtTjf+kMvomd7yGOmTvQHJa CqpH98qYxbnJ8HHaDo9NulzM+xrnpbYirmo2sZ/NUWSX7QzV2Rz/b/eAU5ObibbUxGsS AcxDHhlRrSCq2lLPMx1G5wPuV0G5hWDSdp0bQt+M3DBDsiHlTa7/yIOmJtzQR/b3584i kI61/xtVUcu7Cdm1DtV9kdW5t8xUKC3zz0apPNgkltrgo5dC/oECbZ8jj3Jk/+tUQ+qG C/ag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:in-reply-to:message-id :references:user-agent:mime-version; bh=59QKAlzCo20PiQ6XPvSINe/khVSjSi/vS+Up1F5ddTg=; b=EOquGaStyB29wUJ3B+rMOsmppayN/wXHyiHajTewKodMPDydjf/tTRHrgs5Jyd3FJH S3/hMef1Yz7/EBhlFuecSsrPMOJK3JGGLrkqwo6nhpCl/7Y1SRYeQPkM+MspjCYUx5OD 3x0LPiCrort7JF+Lwc99304aVuaVNCu1Utw69Lqi5LUpcY2tDorNqIkKP8PZOZOw4TYZ dULifwCjsqQkAz//SyY96F14TvJKunLUCDnbWjlfhFsiWgxkVAGoqVTZLP7j9g1TtANB GKKkN2/N0vjx07IQy/Shj3rf6H4i6aV+9B98nxTTzuaAKVHc89ghXDNSu3DyY8OKW92L Uokg== X-Gm-Message-State: ANhLgQ0ZqhT6KB82eR+gIdORhPQz+gD5her9EpkqXqsYk7WBjT4WSRMH bTgVoVP6CHW/FY0jH9XjDEro2Q== X-Received: by 2002:a17:902:8f8e:: with SMTP id z14mr4487286plo.195.1583954722155; Wed, 11 Mar 2020 12:25:22 -0700 (PDT) Received: from [2620:15c:17:3:3a5:23a7:5e32:4598] ([2620:15c:17:3:3a5:23a7:5e32:4598]) by smtp.gmail.com with ESMTPSA id s126sm29094656pfb.143.2020.03.11.12.25.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Mar 2020 12:25:21 -0700 (PDT) Date: Wed, 11 Mar 2020 12:25:20 -0700 (PDT) From: David Rientjes X-X-Sender: rientjes@chino.kir.corp.google.com To: Vlastimil Babka , Neha Agarwal cc: Mike Kravetz , Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org, "Kirill A . Shutemov" Subject: Re: [PATCH] mm/hugetlb: remove unnecessary memory fetch in PageHeadHuge() In-Reply-To: <20200311172440.6988-1-vbabka@suse.cz> Message-ID: References: <20200311172440.6988-1-vbabka@suse.cz> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 11 Mar 2020, Vlastimil Babka wrote: > 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 Fixes: f1e61557f023 ("mm: pack compound_dtor and compound_order into one word in struct page") Acked-by: David Rientjes [+nehaagarwal] We've been running with this patch for a few years and it works as intended. > --- > 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)