git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Ben Peart <peartben@gmail.com>
Cc: "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>, git@vger.kernel.org
Subject: can we deprecate NO_PTHREADS?, was: better wrapper to avoid #ifdef NO_PTHREADS
Date: Sat, 27 Oct 2018 03:12:21 -0400	[thread overview]
Message-ID: <20181027071220.GB17203@sigill.intra.peff.net> (raw)
In-Reply-To: <852ad281-09df-c980-790c-df25e82b3331@gmail.com>

On Fri, Oct 26, 2018 at 10:09:46AM -0400, Ben Peart wrote:

> > Yeah, I don't think carrying around a handful of ints is going to be a
> > big deal.
> 
> Just to be complete, there _is_ an additional cost.  Today, code paths that
> are only executed when there are pthreads available are excluded from the
> binary (via #ifdef).  With this change, those code paths would now be
> included causing some code bloat to NO_PTHREAD threaded images.
> 
> One example of this is in read-cache.c where the ieot read/write functions
> aren't included for NO_PTHREAD but now would be.

Yeah. I think that is also an OK cost. It may bloat the binary a little,
but if we're not running those instructions, they're probably not
bloating CPU cache, etc.

> > I don't think we should break the build on those legacy systems, but
> > it's probably OK to stop thinking of it as "non-threaded platforms are
> > the default and must pay zero cost" and more as "threaded platforms are
> > the default, and non-threaded ones are OK to pay a small cost as long as
> > they still work".
> 
> I agree though I'm still curious if there are still no-threaded platforms
> taking new versions of git.  Perhaps we should do the depreciation warning
> you suggested elsewhere and see how much push back we get.  It's unlikely
> we'd get lucky and be able to stop supporting them completely but it's worth
> asking!

I'm trying to think how that might look. I think putting it into the
binary and warning at runtime is probably a little _too_ obnoxious. Here
are some other options ranging from less to more annoying:

  - mention it in the release notes (guaranteed not to hurt anybody, but
    also likely to be missed)

  - a build-time warning when the NO_PTHREADS is set. Also easy to miss,
    but at least hits the people who are using it.

  - rename NO_PTHREADS to NO_PTHREADS_REALLY, and error out the build
    when NO_PTHREADS is set. That would certainly get people's
    attention.

I guess it would make sense to do them in ascending order. I.e., maybe
start with something like:

diff --git a/Makefile b/Makefile
index b08d5ea258..8ac234e4c3 100644
--- a/Makefile
+++ b/Makefile
@@ -1670,6 +1670,11 @@ ifdef RUNTIME_PREFIX
 endif
 
 ifdef NO_PTHREADS
+$(warning The NO_PTHREADS flag is being considered for deprecation,)
+$(warning which would require all platforms supported by Git to have)
+$(warning some kind of threading support. If your platform does not)
+$(warning support threading, please report it by sending an email to)
+$(warning git@vger.kernel.org.)
 	BASIC_CFLAGS += -DNO_PTHREADS
 else
 	BASIC_CFLAGS += $(PTHREAD_CFLAGS)

If we get no takers, that doesn't prove much, but it builds confidence
in moving to the "REALLY" variant. And if we do get a report, we can be
told this is a bad idea before moving further.

Also, the posting of the patch itself may gather some feedback. ;)

-Peff

  reply	other threads:[~2018-10-27  7:12 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-18  7:05 [PATCH] config.mak.dev: enable -Wunused-function Jeff King
2018-10-18  7:08 ` Jeff King
2018-10-18 15:48 ` Duy Nguyen
2018-10-18 17:09   ` Jeff King
2018-10-18 18:05     ` [PATCH/RFC] thread-utils: better wrapper to avoid #ifdef NO_PTHREADS Nguyễn Thái Ngọc Duy
2018-10-23 20:28       ` Jeff King
2018-10-24  2:58         ` Junio C Hamano
2018-10-26 14:09         ` Ben Peart
2018-10-27  7:12           ` Jeff King [this message]
2018-10-27  7:26           ` Duy Nguyen
2018-10-27  8:17             ` Jeff King
2018-10-18 17:01 ` [PATCH] config.mak.dev: enable -Wunused-function Ramsay Jones
2018-10-19  1:23   ` Junio C Hamano

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=20181027071220.GB17203@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=pclouds@gmail.com \
    --cc=peartben@gmail.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;
as well as URLs for NNTP newsgroup(s).