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=-10.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_2 autolearn=ham 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 A4B67C47096 for ; Fri, 4 Jun 2021 01:07:28 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 4B6146140C for ; Fri, 4 Jun 2021 01:07:28 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4B6146140C Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.microsoft.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 938A96B0036; Thu, 3 Jun 2021 21:07:27 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 8E92B6B006C; Thu, 3 Jun 2021 21:07:27 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 762816B006E; Thu, 3 Jun 2021 21:07:27 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0170.hostedemail.com [216.40.44.170]) by kanga.kvack.org (Postfix) with ESMTP id 43ED26B0036 for ; Thu, 3 Jun 2021 21:07:27 -0400 (EDT) Received: from smtpin14.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id CB7BAAF6F for ; Fri, 4 Jun 2021 01:07:26 +0000 (UTC) X-FDA: 78214253292.14.34D85AA Received: from mail-ej1-f41.google.com (mail-ej1-f41.google.com [209.85.218.41]) by imf25.hostedemail.com (Postfix) with ESMTP id 403486000160 for ; Fri, 4 Jun 2021 01:07:10 +0000 (UTC) Received: by mail-ej1-f41.google.com with SMTP id g20so12019016ejt.0 for ; Thu, 03 Jun 2021 18:07:24 -0700 (PDT) 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:message-id:in-reply-to :references:organization:mime-version:content-transfer-encoding; bh=un5fUz8IxWJJnYpdIXhHBw4mM8q8tHdga8I9S0ipQL8=; b=h2tXoQRkPKiBbpFoQUO0ILtGMQ1ilzHXR4seEpTubTxIlHiKD/AdkVibqCC4YnVPXd iWQntvahfrOnJQyqHZDzvytUqQYd2qfm/qSt7NxorCkEEPoAPsIzzDLWlsVd4G50Qx4j YeoQvf2rSy6AdZYpATvllHZz+CWxOEvtR6sj26nbb9h3eHS+tIMEHrQ2lEpsfa3XseAz iFR3X3qhQvjpxuT07vmoDaI1j73FlFUsTDffaCfGSh5fIDrHi+Y9a5kqR0Bg44noYMM5 PYpqzvhqQ2YYxH1u+CBRN3flKxDJA37HRGmc4mgz/V0tJd+iibw5Ai5cU2yIyg+l5V6M g9vg== X-Gm-Message-State: AOAM532McnpSi8OQBazeFhNwvwoQh+sMx7PCLbydT8JY9xO5NRK1AAJH fhZp3JAh+E59CIFot9Fw1Xk= X-Google-Smtp-Source: ABdhPJyNboBrhnP6+iXknOKJT4T3Wt2/pjB9F0EslZMIu2yefv5lph6V+/K0lOvBWxqfyFb4AJ1F6A== X-Received: by 2002:a17:906:388b:: with SMTP id q11mr1796769ejd.43.1622768838417; Thu, 03 Jun 2021 18:07:18 -0700 (PDT) Received: from localhost (net-37-119-128-179.cust.vodafonedsl.it. [37.119.128.179]) by smtp.gmail.com with ESMTPSA id o64sm2501652eda.83.2021.06.03.18.07.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Jun 2021 18:07:17 -0700 (PDT) Date: Fri, 4 Jun 2021 03:07:12 +0200 From: Matteo Croce To: "Matthew Wilcox (Oracle)" Cc: akpm@linux-foundation.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v10 00/33] Memory folios Message-ID: <20210604030712.11b31259@linux.microsoft.com> In-Reply-To: <20210511214735.1836149-1-willy@infradead.org> References: <20210511214735.1836149-1-willy@infradead.org> Organization: Microsoft X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.33; x86_64-redhat-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Authentication-Results: imf25.hostedemail.com; dkim=none; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=linux.microsoft.com (policy=none); spf=pass (imf25.hostedemail.com: domain of technoboy85@gmail.com designates 209.85.218.41 as permitted sender) smtp.mailfrom=technoboy85@gmail.com X-Stat-Signature: gf3rc3t7sr1j7w63o381ref6jn1j1x75 X-Rspamd-Queue-Id: 403486000160 X-Rspamd-Server: rspam02 X-HE-Tag: 1622768830-464537 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 Tue, 11 May 2021 22:47:02 +0100 "Matthew Wilcox (Oracle)" wrote: > We also waste a lot of instructions ensuring that we're not looking at > a tail page. Almost every call to PageFoo() contains one or more > hidden calls to compound_head(). This also happens for get_page(), > put_page() and many more functions. There does not appear to be a > way to tell gcc that it can cache the result of compound_head(), nor > is there a way to tell it that compound_head() is idempotent. > Maybe it's not effective in all situations but the following hint to the compiler seems to have an effect, at least according to bloat-o-meter: --- a/include/linux/page-flags.h +++ b/include/linux/page-flags.h @@ -179,7 +179,7 @@ enum pageflags { struct page; /* forward declaration */ -static inline struct page *compound_head(struct page *page) +static inline __attribute_const__ struct page *compound_head(struct page *page) { unsigned long head = READ_ONCE(page->compound_head); $ scripts/bloat-o-meter vmlinux.o.orig vmlinux.o add/remove: 3/13 grow/shrink: 65/689 up/down: 21080/-198089 (-177009) Function old new delta ntfs_mft_record_alloc 14414 16627 +2213 migrate_pages 8891 10819 +1928 ext2_get_page.isra 1029 2343 +1314 kfence_init 180 1331 +1151 page_remove_rmap 754 1893 +1139 f2fs_fsync_node_pages 4378 5406 +1028 deferred_split_huge_page 1279 2286 +1007 relock_page_lruvec_irqsave - 975 +975 f2fs_file_write_iter 3508 4408 +900 __pagevec_lru_add 704 1311 +607 [...] pagevec_move_tail_fn 5333 3215 -2118 __activate_page 6183 4021 -2162 __unmap_and_move 2190 - -2190 __page_cache_release 4738 2547 -2191 migrate_page_states 7088 4842 -2246 lru_deactivate_fn 5925 3652 -2273 move_pages_to_lru 7259 4980 -2279 check_move_unevictable_pages 7131 4594 -2537 release_pages 6940 4386 -2554 lru_lazyfree_fn 6798 4198 -2600 ntfs_mft_record_format 2940 - -2940 lru_deactivate_file_fn 9220 5631 -3589 shrink_page_list 20653 15749 -4904 page_memcg 5149 193 -4956 Total: Before=388863526, After=388686517, chg -0.05% I don't know if it breaks something though, nor if it gives some real improvement. -- per aspera ad upstream