linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Waiman Long <longman@redhat.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: linux-kernel@vger.kernel.org, linux-tip-commits@vger.kernel.org,
	Ingo Molnar <mingo@kernel.org>, Davidlohr Bueso <dbueso@suse.de>,
	x86@kernel.org
Subject: Re: [tip: locking/urgent] locking/ww_mutex: Simplify use_ww_ctx & ww_ctx handling
Date: Wed, 17 Mar 2021 10:33:12 -0400	[thread overview]
Message-ID: <4a40bcd9-f0ff-4fd5-19dc-e71961c3c4c6@redhat.com> (raw)
In-Reply-To: <bbfca577-b680-4c73-3f35-22179bd1a498@redhat.com>

On 3/17/21 10:10 AM, Waiman Long wrote:
> On 3/17/21 9:55 AM, Peter Zijlstra wrote:
>> On Wed, Mar 17, 2021 at 09:43:20AM -0400, Waiman Long wrote:
>>
>>> Using gcc 8.4.1, the generated __mutex_lock function has the same 
>>> size (with
>>> last instruction at offset +5179) with or without this patch. Well, 
>>> you can
>>> say that this patch is an no-op wrt generated code.
>> OK, then GCC has gotten better. Because back then I tried really hard
>> but it wouldn't remove the if (ww_ctx) branches unless I had that extra
>> const bool argument.
>>
> I think ww_mutex was merged in 2013. That is almost 8 years ago. It 
> could still be the case that older gcc compilers may not generate the 
> right code. I will try the RHEL7 gcc compiler (4.8.5) to see how it 
> fares. 

I got the same result with the 4.8.5 compiler. The __mutex_lock() 
function has the same size with or without the patch. Note that I used 
the debug config during my RHEL8 compiler test, so the generated code 
size is much larger. With the non-debug config that I used for the 4.8.5 
compiler test, the code is only about 1236 bytes.

Since the current Linux kernel requires gcc 4.9 or above (I downgraded 
the kernel to v5.4 for my 4.8.5 compiler test), the fear of generating 
inferior code due to this patch should be a moot point.

Cheers,
Longman


  parent reply	other threads:[~2021-03-17 14:34 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-16 15:31 [PATCH 0/4] locking/ww_mutex: Fix locktorture ww_mutex test problems Waiman Long
2021-03-16 15:31 ` [PATCH 1/4] locking/ww_mutex: Simplify use_ww_ctx & ww_ctx handling Waiman Long
2021-03-16 18:55   ` Davidlohr Bueso
2021-03-17 12:38   ` [tip: locking/urgent] " tip-bot2 for Waiman Long
2021-03-17 12:59     ` Peter Zijlstra
2021-03-17 13:43       ` Waiman Long
2021-03-17 13:55         ` Peter Zijlstra
2021-03-17 14:10           ` Waiman Long
2021-03-17 14:17             ` Peter Zijlstra
2021-03-17 14:33             ` Waiman Long [this message]
2021-03-16 15:31 ` [PATCH 2/4] locking/ww_mutex: Fix acquire/release imbalance in ww_acquire_init()/ww_acquire_fini() Waiman Long
2021-03-17 12:38   ` [tip: locking/urgent] " tip-bot2 for Waiman Long
2021-03-16 15:31 ` [PATCH 3/4] locking/ww_mutex: Treat ww_mutex_lock() like a trylock Waiman Long
2021-03-17  3:01   ` Davidlohr Bueso
2021-03-17 12:38   ` [tip: locking/urgent] " tip-bot2 for Waiman Long
2021-03-17 13:12     ` Peter Zijlstra
2021-03-17 13:31       ` Peter Zijlstra
2021-03-17 14:03         ` Waiman Long
2021-03-17 15:35           ` Waiman Long
2021-03-17 16:48             ` Peter Zijlstra
2021-03-17 17:40               ` Peter Zijlstra
2021-03-17 17:45                 ` Peter Zijlstra
2021-03-17 18:32                   ` Waiman Long
2021-03-17 19:58                     ` Peter Zijlstra
2021-03-17 20:20                       ` Waiman Long
2021-03-17 18:14                 ` Waiman Long
2021-03-18  2:24   ` [PATCH 3/4] " Boqun Feng
2021-03-18  2:54     ` Waiman Long
2021-03-18  6:36       ` Boqun Feng
2021-03-16 15:31 ` [PATCH 4/4] locking/locktorture: Fix incorrect use of ww_acquire_ctx in ww_mutex test Waiman Long
2021-03-17  5:16   ` Davidlohr Bueso
2021-03-17 13:21     ` Waiman Long

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=4a40bcd9-f0ff-4fd5-19dc-e71961c3c4c6@redhat.com \
    --to=longman@redhat.com \
    --cc=dbueso@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    --cc=x86@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;
as well as URLs for NNTP newsgroup(s).