mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Paul Smith <psmith@gnu.org>
To: David Laight <David.Laight@ACULAB.COM>,
	'Linus Torvalds' <torvalds@linux-foundation.org>
Cc: 'Arnd Bergmann' <arnd@arndb.de>,
	'Masahiro Yamada' <yamada.masahiro@socionext.com>,
	'Linux Kernel Mailing List' <linux-kernel@vger.kernel.org>
Subject: Re: I disabled more compiler warnings..
Date: Wed, 13 May 2020 11:32:50 -0400	[thread overview]
Message-ID: <6a5a75043f697a130422fbc3a3f8464dc6d03e2f.camel@gnu.org> (raw)
In-Reply-To: <4a540a5d341c468bae131934b413e4ce@AcuMS.aculab.com>

On Wed, 2020-05-13 at 08:21 +0000, David Laight wrote:
> > GNU make uses pselect(), on systems that support it.  On systems
> > that don't support pselect() it uses a trick I described in another
> > email: we dup() the FD, read() on the dup, then in the SIGCHLD
> > handler we close() the dup.
> 
> Does that even work - seems like it requires close() to abort poll().
> Better is to just have the SIGCHLD handler write a byte into a pipe.

Sorry I guess I wasn't clear.

We use _either_ pselect(), _or_ the close()-the-dup trick.  Not both.

If we have pselect() we use that: no dup'ing or close'ing needed.

If we don't have pselect() we use the close() in the signal handler. 
In that case we're just waiting in the read(), we're not using select()
or poll() or whatever.  It's definitely the case that if we're waiting
in read() and someone closes the FD, we'll wake up! :)

> > Having the parent not acquire a token at all won't work; without
> > limiting sub-makes it means you might have 100's of them running at
> > the same time, even with -j2 or whatever.
> 
> Hmmm... 
> That means the sub-make must always hold one token.
> Otherwise the parent-make could use it to create a new sub-make.

Right, my first idea has this same problem so it won't work.

> Actually the token pipe can be opened NON_BLOCK because poll()
> can/will be used to wait for a token.

Again, that only works on systems where pselect() is available.

> So you always try to read a token - even when you have one 'in your
> hand' (either entry or because a job just finished).  If it isn't the
> 'abort' one, put it back.

Something like that would be needed, yes.

Note this is only needed in a rare situation where you're running with
parallelism enabled BUT you have a makefile which never actually tries
to run two or more jobs at the same time for some reason.


  reply	other threads:[~2020-05-13 15:32 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-10 19:33 Linus Torvalds
2020-05-11  7:43 ` David Laight
2020-05-11 17:41   ` Linus Torvalds
2020-05-11 17:58     ` Paul Smith
2020-05-11 19:33       ` Linus Torvalds
2020-05-11 20:25         ` Paul Smith
2020-05-11 21:09       ` David Laight
2020-05-12  7:55         ` David Laight
2020-05-12 14:35           ` Paul Smith
2020-05-12 15:04             ` David Laight
2020-05-12 16:55               ` Paul Smith
2020-05-13  8:21                 ` David Laight
2020-05-13 15:32                   ` Paul Smith [this message]
2020-05-13 15:53                     ` David Laight
2020-05-13 16:06                       ` Paul Smith
2020-05-11  9:03 ` Arnd Bergmann
2020-05-11 11:11   ` Arnd Bergmann

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=6a5a75043f697a130422fbc3a3f8464dc6d03e2f.camel@gnu.org \
    --to=psmith@gnu.org \
    --cc=David.Laight@ACULAB.COM \
    --cc=arnd@arndb.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@linux-foundation.org \
    --cc=yamada.masahiro@socionext.com \
    /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

Powered by JetHome