public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Mike Rapoport <rppt@kernel.org>
To: Xie Yuanbin <qq570070308@gmail.com>
Cc: akpm@linux-foundation.org, Liam.Howlett@oracle.com,
	david@kernel.org, justinstitt@google.com,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org, ljs@kernel.org,
	llvm@lists.linux.dev, mhocko@suse.com, morbo@google.com,
	nathan@kernel.org, nick.desaulniers+lkml@gmail.com,
	surenb@google.com, vbabka@kernel.org
Subject: Re: [PATCH] mm: optimize once judgment with clang
Date: Sun, 8 Mar 2026 20:03:07 +0200	[thread overview]
Message-ID: <aa2523KDNwWXHbDD@kernel.org> (raw)
In-Reply-To: <20260307144135.380683-1-qq570070308@gmail.com>

On Sat, Mar 07, 2026 at 10:41:35PM +0800, Xie Yuanbin wrote:
> On Sat, 7 Mar 2026 10:12:18 +0200, Mike Rapoport wrote:
> > On Sat, Mar 07, 2026 at 02:54:04PM +0800, Xie Yuanbin wrote:
> >> commit 242b872239f6a7deacbc ("include/linux/once_lite.h: fix judgment in
> >> WARN_ONCE with clang") helps optimize performance and size under the
> >> clang compiler, but the modification is not complete.
> >
> > How much does it actually optimize for size?
> 
> Basing on commit a0ae2a256046c0c5d377 ("Add linux-next specific
> files for 20260306"), compiler "Debian clang version 21.1.8 (5)",
> arm64 default defconfig, and setting CONFIG_CC_OPTIMIZE_FOR_SIZE=y,
> the size result is:
> |                                    | size     |
> |                                   -|         -|
> | Image.gz                           | 14256146 |
> | size of ".text" section in vmlinex | 17035264 |
> 
> Basing on above, revert the commit 242b872239f6a7deacbc
> ("include/linux/once_lite.h: fix judgment in WARN_ONCE with clang"),
> and build again:
> |                                    | size            |
> |                                   -|	              -|
> | Image.gz                           | 14258152(+2006) |
> | size of ".text" section in vmlinex | 17039360(+4096) |

It would be nice to see where the difference is with scripts/bloat-o-meter.

And while commit 242b872239f6a7deacbc is a oneliner that essentially
updates most of the _ONCE constructs, I'm not convinced that the churn in
the patch that updates include/linux/mmdebug.h worth it.
Do you have the numbers for this patch as well?

> > Note that performance is really not critical here because we are already
> > dealing with slow path of debug code.
> 
> It seems that WARN_ON_ONCE_GFP() is not affected by in CONFIG_DEBUG_VM,
> and it is used in __alloc_frozen_pages_noprof(), which seems to be a hot
> path.

What might be useful there is to change the order of conditions so that
__ret_warn_once will be evaluated first.

-- 
Sincerely yours,
Mike.

  reply	other threads:[~2026-03-08 18:03 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-07  6:54 [PATCH] mm: optimize once judgment with clang Xie Yuanbin
2026-03-07  8:12 ` Mike Rapoport
2026-03-07 10:48   ` David Laight
2026-03-07 14:41   ` Xie Yuanbin
2026-03-08 18:03     ` Mike Rapoport [this message]
2026-03-09 15:32       ` Xie Yuanbin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aa2523KDNwWXHbDD@kernel.org \
    --to=rppt@kernel.org \
    --cc=Liam.Howlett@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=david@kernel.org \
    --cc=justinstitt@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=ljs@kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=mhocko@suse.com \
    --cc=morbo@google.com \
    --cc=nathan@kernel.org \
    --cc=nick.desaulniers+lkml@gmail.com \
    --cc=qq570070308@gmail.com \
    --cc=surenb@google.com \
    --cc=vbabka@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox