From: Waiman Long <firstname.lastname@example.org> To: Peter Oskolkov <email@example.com>, Peter Zijlstra <firstname.lastname@example.org> Cc: Linux Kernel Mailing List <email@example.com>, Thomas Gleixner <firstname.lastname@example.org>, Ingo Molnar <email@example.com>, Ingo Molnar <firstname.lastname@example.org>, Darren Hart <email@example.com>, Vincent Guittot <firstname.lastname@example.org>, Peter Oskolkov <email@example.com>, Andrei Vagin <firstname.lastname@example.org>, Paul Turner <email@example.com>, Ben Segall <firstname.lastname@example.org>, Aaron Lu <email@example.com> Subject: Re: [PATCH for 5.9 1/3] futex: introduce FUTEX_SWAP operation Date: Thu, 23 Jul 2020 23:00:50 -0400 [thread overview] Message-ID: <firstname.lastname@example.org> (raw) In-Reply-To: <CAFTs51UJhC9TmXkzz8VbDNmkSEyZE29=dRdUi65TDpSYqoK5vw@mail.gmail.com> On 7/23/20 8:25 PM, Peter Oskolkov wrote: > On Thu, Jul 23, 2020 at 4:28 AM Peter Zijlstra <email@example.com> wrote: > > Thanks a lot for your comments, Peter! My answers below. > >> On Wed, Jul 22, 2020 at 04:45:36PM -0700, Peter Oskolkov wrote: >>> This patchset is the first step to open-source this work. As explained >>> in the linked pdf and video, SwitchTo API has three core operations: wait, >>> resume, and swap (=switch). So this patchset adds a FUTEX_SWAP operation >>> that, in addition to FUTEX_WAIT and FUTEX_WAKE, will provide a foundation >>> on top of which user-space threading libraries can be built. >> The PDF and video can go pound sand; you get to fully explain things >> here. > Will do. Should I expand the cover letter or the commit message? (I'll probably > split the first patch into two in the latter case). You should put it mostly in the commit message which will be part of the git log history. The cover letter, on the other hand, is not part of the git log. > >> What worries me is how FUTEX_SWAP would interact with the future >> FUTEX_LOCK / FUTEX_UNLOCK. When we implement pthread_mutex with those, >> there's very few WAIT/WAKE left. > [+cc Waiman Long] > > I've looked through the latest FUTEX_LOCK patchset I could find ( > https://lore.kernel.org/patchwork/cover/772643/ and related), and it seems > that FUTEX_SWAP and FUTEX_LOCK/FUTEX_UNLOCK patchsets > address the same issue (slow wakeups) but for different use cases: > > FUTEX_LOCK/FUTEX_UNLOCK uses spinning and lock stealing to > improve futex wake/wait performance in high contention situations; > FUTEX_SWAP is designed to be used for fast context switching with > _no_ contention by design: the waker that is going to sleep, and the wakee > are using different futexes; the userspace will have a futex per thread/task, > and when needed the thread/task will either simply sleep on its futex, > or context switch (=FUTEX_SWAP) into a different thread/task. I agree that it is a different use case. I just hope that you keep the possible future extension to support FUTEX_LOCK/UNLOCK in mind so that they won't conflict with each other. Cheers, Longman
next prev parent reply other threads:[~2020-07-24 3:01 UTC|newest] Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-07-22 23:45 [PATCH for 5.9 0/3] FUTEX_SWAP (tip/locking/core) Peter Oskolkov 2020-07-22 23:45 ` [PATCH for 5.9 1/3] futex: introduce FUTEX_SWAP operation Peter Oskolkov 2020-07-23 11:27 ` Peter Zijlstra 2020-07-24 0:25 ` Peter Oskolkov 2020-07-24 3:00 ` Waiman Long [this message] 2020-07-24 3:22 ` Peter Oskolkov 2020-07-27 9:51 ` peterz 2020-07-28 0:01 ` Peter Oskolkov 2020-07-22 23:45 ` [PATCH for 5.9 2/3] futex/sched: add wake_up_process_prefer_current_cpu, use in FUTEX_SWAP Peter Oskolkov 2020-07-22 23:45 ` [PATCH for 5.9 3/3] selftests/futex: add futex_swap selftest Peter Oskolkov
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 \ --firstname.lastname@example.org \ --email@example.com \ --firstname.lastname@example.org \ --email@example.com \ --firstname.lastname@example.org \ --email@example.com \ --firstname.lastname@example.org \ --email@example.com \ --firstname.lastname@example.org \ --email@example.com \ --firstname.lastname@example.org \ --email@example.com \ --firstname.lastname@example.org \ --email@example.com \ --firstname.lastname@example.org \ --subject='Re: [PATCH for 5.9 1/3] futex: introduce FUTEX_SWAP operation' \ /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
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).