From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9F72BC4338F for ; Fri, 13 Aug 2021 14:26:38 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 2EBFF61042 for ; Fri, 13 Aug 2021 14:26:38 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 2EBFF61042 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id C5FE16B006C; Fri, 13 Aug 2021 10:26:37 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id BC2046B0071; Fri, 13 Aug 2021 10:26:37 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A8A8A8D0001; Fri, 13 Aug 2021 10:26:37 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0248.hostedemail.com [216.40.44.248]) by kanga.kvack.org (Postfix) with ESMTP id 8F6DF6B006C for ; Fri, 13 Aug 2021 10:26:37 -0400 (EDT) Received: from smtpin01.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 29222181B7E39 for ; Fri, 13 Aug 2021 14:26:37 +0000 (UTC) X-FDA: 78470283234.01.EEAB5CD Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf09.hostedemail.com (Postfix) with ESMTP id DA9F93000105 for ; Fri, 13 Aug 2021 14:26:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=EYb/9zUimDNR2w9ad52P1RefLWJn4cpBhY0HIgJB8H8=; b=TpP99k5NnxUB/d+6P2Rlg29XNC Ef04mLJa7TxZjQPx/SU1CvoztFpDz2TF1EG7jZQcdCjttY7axZtHEKc+QqvGFTEKlqM4OAontYZWt IvVCYUjAMALot0VK40Yh4SAlToVdkUpJz40L5l6NMe/W86lIREOLjfSGdSzg3vo5TfGkYuDAdgSfJ LG/dMHAI9IPfmOO4suOtYHMTcExe4XzEuFmCP8vLW5MbWYzxWEO5PB5jtmgfxCNOncVm/lWquEUKg 1kcBoGaaJYLcUrIbylJfE0F6RVp5XDDO85p00iq1l0+Se0VC1FUu4Pc3jr2lYx0Qv2VN5Uuvfvs4c OzjSrTUQ==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1mEY71-00FkUQ-BW; Fri, 13 Aug 2021 14:24:50 +0000 Date: Fri, 13 Aug 2021 15:24:43 +0100 From: Matthew Wilcox To: Vlastimil Babka Cc: Muchun Song , akpm@linux-foundation.org, william.kucharski@oracle.com, kirill.shutemov@linux.intel.com, dhowells@redhat.com, hannes@cmpxchg.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH] mm: remove redundant compound_head() calling Message-ID: References: <20210811101431.83940-1-songmuchun@bytedance.com> <808194f6-e5d0-59e4-ffd5-2c77a907232c@suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <808194f6-e5d0-59e4-ffd5-2c77a907232c@suse.cz> X-Rspamd-Queue-Id: DA9F93000105 Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=TpP99k5N; dmarc=none; spf=none (imf09.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org X-Rspamd-Server: rspam04 X-Stat-Signature: gb7779ertesxf35jkcoiequr3ywijwq7 X-HE-Tag: 1628864796-862585 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: On Fri, Aug 13, 2021 at 04:02:33PM +0200, Vlastimil Babka wrote: > On 8/11/21 12:14 PM, Muchun Song wrote: > > There is a READ_ONCE() in the macro of compound_head(), which will > > prevent compiler from optimizing the code when there are more than > > once calling of it in a function. Remove the redundant calling of > > compound_head() from page_to_index() and page_add_file_rmap() for > > better code generation. > > > > Signed-off-by: Muchun Song > > Seems to be compatible with folio/for-next and not made redundant by that (yet? > didn't check the branches planned for future versions), so OK. But long-term I'd > expect these optimizations to be obsoleted by the folio work. Yes, I haven't touched page_add_file_rmap() in my tree yet. Trying to keep my focus on page cache instead of working on more generic mm stuff. Hopefully other people will work on those pieces once the folio work lands. Looking at page_add_file_rmap(), it needs someone to think in detail about what 'compound' means in the context of sub-PMD-sized compound pages. I suspect it really means "map_as_pmd".