public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "mztyvop at 0pointer dot net" <sourceware-bugzilla@sourceware.org>
To: glibc-bugs@sourceware.org
Subject: [Bug libc/26371] [RFE] please add clone3() wrapper (in particular the CLONE_INTO_CGROUP feature of it)
Date: Mon, 21 Sep 2020 12:37:27 +0000	[thread overview]
Message-ID: <bug-26371-131-XqAomXpuBD@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-26371-131@http.sourceware.org/bugzilla/>

https://sourceware.org/bugzilla/show_bug.cgi?id=26371

--- Comment #7 from Lennart Poettering <mztyvop at 0pointer dot net> ---
So we do employ threads, but in very limited fashion. Primarily there are four
uses for threads in PID 1 right now: 

1. We need an async close() sometimes, for fds that people pass to us via D-Bus
and similar, since they can send us arbitrary stuff, i.e. dead NFS or FUSE fd
handles where close() takes ages to finish. For "dangerous" fds like that we
fork off small threads that do nothing but invoke close().

2. Some ioctls (in particular autofs related) are blocking, but we want to
integrate them into our usual event loop. So we run minimal threads for them.
This is used in the .automount support in systemd.

3. When we notice that a shutdown operation is initiated we fork off a thread
that just calls sync() in order to start flushing out buffers early on without
having to wait for it needlessly.

4. When a service shuts down that has RuntimeDirectory= set we do the
equivalent of "rm -rf" in a background thread to get rid of the directory
again, since apparently people sometimes have ridiculously large runtime dirs,
that take ages to clear out. Similar if people have PrivateTmp= set, we empty
out the private /tmp/ and /var/tmp/ subdirs when services go down, the same
way.

In general we try to avoid threads though, and when we have them we try to
minimize them, i.e. they do simple, ideally single operations only. The "rm
-rf" thing is by far the most complex.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

  parent reply	other threads:[~2020-09-21 12:37 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-11 10:24 [Bug libc/26371] New: " mztyvop at 0pointer dot net
2020-08-12 13:35 ` [Bug libc/26371] " christian.brauner at ubuntu dot com
2020-08-25 12:39 ` fweimer at redhat dot com
2020-08-25 12:46 ` christian.brauner at ubuntu dot com
2020-08-25 14:57 ` mztyvop at 0pointer dot net
2020-08-25 15:07 ` mztyvop at 0pointer dot net
2020-08-25 15:12 ` mztyvop at 0pointer dot net
2020-09-21 11:38 ` fweimer at redhat dot com
2020-09-21 12:37 ` mztyvop at 0pointer dot net [this message]
2020-09-22  9:45 ` fweimer at redhat dot com
2021-06-29 22:40 ` crrodriguez at opensuse dot org
2023-06-01 12:53 ` bluca at debian dot org
2023-06-01 13:24 ` bluca at debian dot org
2023-06-01 18:46 ` carlos at redhat dot com
2023-06-02  0:58 ` sam at gentoo dot org
2023-06-26 11:48 ` bluca at debian dot org
2023-07-03 18:52 ` adhemerval.zanella at linaro dot org
2023-07-03 19:32 ` bluca at debian dot org
2023-09-05 16:11 ` adhemerval.zanella at linaro dot org
2023-09-05 16:20 ` bluca at debian dot org
2024-02-06 10:59 ` bluca at debian dot org
2024-02-06 12:38 ` adhemerval.zanella at linaro dot org

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=bug-26371-131-XqAomXpuBD@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=glibc-bugs@sourceware.org \
    /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 read-only IMAP folder(s) and NNTP newsgroup(s).