From owner-dev-commits-src-all@freebsd.org Fri Mar 12 12:00:38 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E70C55771F2; Fri, 12 Mar 2021 12:00:38 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4Dxksf0tyJz3kp5; Fri, 12 Mar 2021 12:00:37 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.16.1/8.16.1) with ESMTPS id 12CC0Tsp070045 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Fri, 12 Mar 2021 14:00:32 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua 12CC0Tsp070045 Received: (from kostik@localhost) by tom.home (8.16.1/8.16.1/Submit) id 12CC0SLD070042; Fri, 12 Mar 2021 14:00:28 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Fri, 12 Mar 2021 14:00:28 +0200 From: Konstantin Belousov To: Hans Petter Selasky Cc: John Baldwin , 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: References: <202103100952.12A9qRKR040117@gitrepo.freebsd.org> <2b1739ab-000c-ca28-5a59-0a3e19ef4591@selasky.org> <5aaa5f2a-a67d-a495-7f56-a6b31c2494c7@FreeBSD.org> <3dcd63b0-fe90-2855-f349-2117ca4b6b26@selasky.org> <8fe37b5e-29a7-ffeb-fddb-3b31a6e79ab0@selasky.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <8fe37b5e-29a7-ffeb-fddb-3b31a6e79ab0@selasky.org> X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on tom.home X-Rspamd-Queue-Id: 4Dxksf0tyJz3kp5 X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Mar 2021 12:00:39 -0000 On Thu, Mar 11, 2021 at 08:20:05PM +0100, Hans Petter Selasky wrote: > On 3/11/21 8:04 PM, Konstantin Belousov wrote: > > On Thu, Mar 11, 2021 at 07:41:53PM +0100, Hans Petter Selasky wrote: > > > On 3/11/21 7:35 PM, Konstantin Belousov wrote: > > > > And I dislike this. It is yet another case of introducing consumer-specific > > > > logic into core. Isn't netepoch example enough? > > > > > > > > I presented another patch to Hans, where task and mm allocations are > > > > switched to zones, and the zones have reserve applied. Then allocations > > > > from ithreads use the reserve. > > > > > > > > There is one detail there, reserve is finite, for x86 I set it to the > > > > total limit of interrupts. This somewhat breaks if interrupts are > > > > deallocated and reallocated, but I think it is good enough even with > > > > this wart. > > > > > > Hi, > > > > > > Your patch doesn't address the issue of initializing the pointers in > > > question once. Still, for every call, we need to check if the pointer is > > > valid. This is not neccessary. > > I do not understand what you are saying there. > > Which pointers? How does it not address? > > Hi, > > The current code calls linux_set_current() for every interrupt and timer > callback. That means we continue to check td_lkpi_task for NULL for every > one of these calls. Not strictly needed. 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 - they are already there anyway. What is your point? > > > > > > > > > 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.