Date: Fri, 12 Mar 2021 14:15:02 +0100 From: Hans Petter Selasky <hps@selasky.org> To: Konstantin Belousov <kostikbel@gmail.com> Cc: John Baldwin <jhb@freebsd.org>, src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: d1cbe7908986 - main - Allocating the LinuxKPI current structure from an interrupt thread must be done using the M_NOWAIT flag after 1ae20f7c70ea . Message-ID: <eb9475cc-2aab-55ce-5aa5-8f6c2ca8cb08@selasky.org> In-Reply-To: <YEtX3GmTt5APQ8Mz@kib.kiev.ua> References: <202103100952.12A9qRKR040117@gitrepo.freebsd.org> <YEiZwWT28AeXzQjA@kib.kiev.ua> <2b1739ab-000c-ca28-5a59-0a3e19ef4591@selasky.org> <5aaa5f2a-a67d-a495-7f56-a6b31c2494c7@FreeBSD.org> <ba608afb-d8bb-242a-9170-e30b2291411e@selasky.org> <YEpi65EJZrFHf5Dj@kib.kiev.ua> <3dcd63b0-fe90-2855-f349-2117ca4b6b26@selasky.org> <YEppt/dtNwdmxDHP@kib.kiev.ua> <8fe37b5e-29a7-ffeb-fddb-3b31a6e79ab0@selasky.org> <YEtX3GmTt5APQ8Mz@kib.kiev.ua>
next in thread | previous in thread | raw e-mail | index | archive | help
Hi, On 3/12/21 1:00 PM, Konstantin Belousov wrote: > On Thu, Mar 11, 2021 at 08:20:05PM +0100, Hans Petter Selasky wrote: ... > And how this would change? The linux_set_current() calls are spread all > over the linuxkpi code, so > - you cannot eliminate them for interrupt thread context Regular interrupt threads typically don't use the "current" or "task structure" at all. > - they are already there anyway. For user-space, yes. > What is your point? I still believe an own UMA zone is overkill for the purpose of task_struct . We could just pre-allocate these structures into a linked list, and dequeue these for interrupt threads only. Every time a new interrupt is allocated we allocate one more of these structures beforehand, and then we use that structure back when the ITHREAD flags is set in the thread structure, similar to what you are doing, except we don't use UMA zones. >> >>> >>>> >>>> Also I don't see why we need to create a own UMA zone for these simple >>>> structures. Won't the per-CPU sysctl consume more memory than the actual >>>> task structures being allocated? >>> Dedicated UMA zone allows to gracefully solve the requirement of non-failing >>> allocation in non-sleepable context. This is much simpler and cleaner than >>> either trying to enumerate all existing ithreads or adding consumer-specific >>> controls into generic kernel facility. >>> >> >> Maybe I'm new to UMA zones. The M_USE_RESERVE can also be used with malloc() >> ? > Yes M_USE_RESERVE can be used on zones without reserve (like malloc zones), > but it would have a different meaning. On allocation failure due to low > memory, for zones with reserve, it means: > - first look at reserve, and if nothing left, you are allowed to consume > the last free page in the system > For zones without reserve, it just allows to utilize the last free page. > In other words, if you have a reserve in zone, alloc requests are guaranteed > to not fail regardless of the free memory. OK. --HPS
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?eb9475cc-2aab-55ce-5aa5-8f6c2ca8cb08>