public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 00/11] nptl: pthread cancellation refactor
@ 2021-05-26 16:57 Adhemerval Zanella
  2021-05-26 16:57 ` [PATCH 01/11] nptl: Move Linux createthread to nptl Adhemerval Zanella
                   ` (10 more replies)
  0 siblings, 11 replies; 38+ messages in thread
From: Adhemerval Zanella @ 2021-05-26 16:57 UTC (permalink / raw)
  To: libc-alpha

This patchset refactor and simplifies the nptl cancellation code.
The first 4 patches just add NFC changes and a new test.

The 5th patch fixes an memory leak issue when pthread_create fails to
setup either the scheduling or affinity parameter.  The asynchronous
cancellation is removed in favor of using a member to indicate the
setup has failed and letting the created thread to deallocate the
memory (similar on how detached threads do).

The 6h patch move the signal handler setup to pthread_cancel, now that
asynchronous cancellation is not used anymore on thread creation.

The 7th remove the CANCELING_BITMASK bit, since it is mainly used to
signal that a syscall that has returned should be cancelled (which is
a wrong assumption, since syscall with side-effects should *not* be
cancelled as per BZ#12683).

The 8th and 9th patches move both the cancel state and cancel type out
of 'cancelhandling' variable, since with CANCELING_BITMASK and
pthread_cancel change in previous patch they are not accessed in a
concurrent manner.

The 10th patch consolidates the raise as 'pthread_kill(pthread_self())'.

Finally, the 11th patch uses pthread_kill on pthread_cancel.

Adhemerval Zanella (11):
  nptl: Move Linux createthread to nptl
  nptl: Move createthread to pthread_create
  support: Add xpthread_attr_setaffinity_np wrapper
  nptl: Add pthread_attr_setaffinity_np failure test
  nptl: Deallocate the thread stack on setup failure (BZ #19511)
  nptl: Install cancellation handler on pthread_cancel
  nptl: Remove CANCELING_BITMASK
  nptl: Move cancel state out of cancelhandling
  nptl: Move cancel type out of cancelhandling
  nptl: Implement raise in terms of pthread_kill
  nptl: Use pthread_kill on pthread_cancel

 include/pthread.h                      |   5 +
 manual/pattern.texi                    |   1 -
 manual/process.texi                    |   3 +-
 nptl/Makefile                          |   1 +
 nptl/Versions                          |   3 +-
 nptl/allocatestack.c                   |   3 +
 nptl/cancellation.c                    |  62 ++--------
 nptl/cleanup_defer.c                   |  46 +-------
 nptl/createthread.c                    |  45 --------
 nptl/descr.h                           |  32 ++----
 nptl/libc-cleanup.c                    |  46 +-------
 nptl/pthreadP.h                        |  24 +---
 nptl/pthread_cancel.c                  | 145 ++++++++---------------
 nptl/pthread_create.c                  | 151 ++++++++++++++++++------
 nptl/pthread_join_common.c             |   7 +-
 nptl/pthread_kill.c                    |  52 ++++++---
 nptl/pthread_self.c                    |   4 +-
 nptl/pthread_setcancelstate.c          |  36 +-----
 nptl/pthread_setcanceltype.c           |  41 +------
 nptl/pthread_testcancel.c              |  11 +-
 nptl/tst-pthread-attr-affinity-fail.c  |  54 +++++++++
 support/Makefile                       |   1 +
 support/xpthread_attr_setaffinity_np.c |  28 +++++
 support/xthread.h                      |   3 +
 sysdeps/htl/pthreadP.h                 |   2 -
 sysdeps/posix/raise.c                  |  11 +-
 sysdeps/unix/sysv/linux/createthread.c | 153 -------------------------
 sysdeps/unix/sysv/linux/raise.c        |  52 ---------
 28 files changed, 369 insertions(+), 653 deletions(-)
 delete mode 100644 nptl/createthread.c
 create mode 100644 nptl/tst-pthread-attr-affinity-fail.c
 create mode 100644 support/xpthread_attr_setaffinity_np.c
 delete mode 100644 sysdeps/unix/sysv/linux/createthread.c
 delete mode 100644 sysdeps/unix/sysv/linux/raise.c

-- 
2.30.2


^ permalink raw reply	[flat|nested] 38+ messages in thread

end of thread, other threads:[~2021-06-16 12:46 UTC | newest]

Thread overview: 38+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-26 16:57 [PATCH 00/11] nptl: pthread cancellation refactor Adhemerval Zanella
2021-05-26 16:57 ` [PATCH 01/11] nptl: Move Linux createthread to nptl Adhemerval Zanella
2021-05-26 17:14   ` Florian Weimer
2021-05-26 16:57 ` [PATCH 02/11] nptl: Move createthread to pthread_create Adhemerval Zanella
2021-05-26 17:16   ` Florian Weimer
2021-05-26 17:29     ` Adhemerval Zanella
2021-05-26 16:57 ` [PATCH 03/11] support: Add xpthread_attr_setaffinity_np wrapper Adhemerval Zanella
2021-05-26 17:17   ` Florian Weimer
2021-05-27 22:35   ` Joseph Myers
2021-05-28  1:08     ` Adhemerval Zanella
2021-05-26 16:57 ` [PATCH 04/11] nptl: Add pthread_attr_setaffinity_np failure test Adhemerval Zanella
2021-05-26 17:21   ` Florian Weimer
2021-05-26 17:30     ` Adhemerval Zanella
2021-05-26 16:57 ` [PATCH 05/11] nptl: Deallocate the thread stack on setup failure (BZ #19511) Adhemerval Zanella
2021-05-26 17:33   ` Florian Weimer
2021-05-26 17:51     ` Adhemerval Zanella
2021-05-26 17:58       ` Florian Weimer
2021-05-26 19:19         ` Adhemerval Zanella
2021-05-26 18:21   ` Andreas Schwab
2021-05-26 18:40     ` Adhemerval Zanella
2021-05-26 19:26   ` Adhemerval Zanella
2021-05-27  7:43     ` Florian Weimer
2021-05-26 16:57 ` [PATCH 06/11] nptl: Install cancellation handler on pthread_cancel Adhemerval Zanella
2021-05-26 17:38   ` Florian Weimer
2021-05-26 17:52     ` Adhemerval Zanella
2021-05-26 16:57 ` [PATCH 07/11] nptl: Remove CANCELING_BITMASK Adhemerval Zanella
2021-05-26 18:02   ` Florian Weimer
2021-06-15 22:07   ` Florian Weimer
2021-06-15 23:33     ` Adhemerval Zanella
2021-06-16 12:46       ` Adhemerval Zanella
2021-05-26 16:57 ` [PATCH 08/11] nptl: Move cancel state out of cancelhandling Adhemerval Zanella
2021-05-26 18:20   ` Florian Weimer
2021-05-27 16:40     ` Adhemerval Zanella
2021-05-27 16:48       ` Florian Weimer
2021-05-27 16:57         ` Adhemerval Zanella
2021-05-26 16:57 ` [PATCH 09/11] nptl: Move cancel type " Adhemerval Zanella
2021-05-26 16:57 ` [PATCH 10/11] nptl: Implement raise in terms of pthread_kill Adhemerval Zanella
2021-05-26 16:57 ` [PATCH 11/11] nptl: Use pthread_kill on pthread_cancel Adhemerval Zanella

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 read-only IMAP folder(s) and NNTP newsgroup(s).