classification
Title: Elide Py_atomic fences when WITH_THREAD is disabled?
Type: performance Stage: resolved
Components: Versions: Python 3.6
process
Status: closed Resolution: out of date
Dependencies: Superseder:
Assigned To: Nosy List: jyasskin, larry, pitrou, vstinner
Priority: low Keywords:

Created on 2016-04-16 03:29 by larry, last changed 2020-06-25 09:51 by vstinner. This issue is now closed.

Messages (5)
msg263537 - (view) Author: Larry Hastings (larry) * (Python committer) Date: 2016-04-16 03:29
Right now the atomic access fence macros in pyatomic.h are unconditional.  This means that they're active even even when you "./configure --without-threads".  If Python thread support is disabled, surely we don't need to ensure atomic access to variables, because there aren't any other threads to compete with.

Shouldn't we add

#ifdef WITH_THREAD
/* current code goes here */
#else
#define _Py_atomic_load_relaxed(x) (x)
/* etc */
#endif

?
msg263543 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2016-04-16 09:17
I never liked the option to disable thread support. I don't think that
anyone uses it but it requires many #ifdef in the code. I would prefer to
drop the option.
msg263607 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2016-04-17 13:23
This sounds like additional hassle for not much gain. Agreed with Victor.
msg263608 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2016-04-17 14:43
Discussion about --without-threads:

* May 2012
  https://mail.python.org/pipermail/python-dev/2012-May/119333.html
* Follow-up january 2013
  https://mail.python.org/pipermail/python-dev/2013-January/123505.html
msg372334 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-06-25 09:51
> I never liked the option to disable thread support.

I close the issue. It is not longer possible to build Python without threading support.
History
Date User Action Args
2020-06-25 09:51:39vstinnersetstatus: open -> closed
resolution: out of date
messages: + msg372334

stage: test needed -> resolved
2016-04-17 14:43:43vstinnersetmessages: + msg263608
2016-04-17 13:23:21pitrousetnosy: + pitrou
messages: + msg263607
2016-04-16 09:17:43vstinnersetmessages: + msg263543
2016-04-16 03:29:24larrycreate