From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 55647C433EF for ; Sat, 25 Dec 2021 22:58:45 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 470286B0072; Sat, 25 Dec 2021 17:58:44 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 41E796B0073; Sat, 25 Dec 2021 17:58:44 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 30CC66B0074; Sat, 25 Dec 2021 17:58:44 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0050.hostedemail.com [216.40.44.50]) by kanga.kvack.org (Postfix) with ESMTP id 22B4F6B0072 for ; Sat, 25 Dec 2021 17:58:44 -0500 (EST) Received: from smtpin20.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id C8B938249980 for ; Sat, 25 Dec 2021 22:58:43 +0000 (UTC) X-FDA: 78957832926.20.FF3A723 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf17.hostedemail.com (Postfix) with ESMTP id 65FB840038 for ; Sat, 25 Dec 2021 22:58:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=jwyn7J+5HFBWS8k5TLrBn4kjmRBNmjy0LNtn6dt0gQQ=; b=jMGiaPSBzB2N/vNCwVxThESdyG 0Km4bTq+EYMi0Mky9AHHz8cNRt+dHAg6KgVATJsAmXX1cATNJM4bSSAzrtDlXWo9qg2BjfKp81hJm oin5+4GT2NeGycfra81v5V5GL2coTH5OGsrVIjT15Q/ogUa3lmPPyOsFmeKbxASqq6TsVKheDvx8w OxIuby3T0U4mZaMt9eN0uRtwrM8KEf6r2f1FpXvmpggmgsqmZ6swhXiviq++I8y9TFNcFgcsR00X3 2bJEV70NFPpa7YjVB97bIF5Xl6RVFEUHqfxWlAjYzbrzplFWPScqWh5MqMjSSsCNpP6yI6fBu/9mD 4AGVMxKw==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1n1Fzh-006952-W0; Sat, 25 Dec 2021 22:58:30 +0000 Date: Sat, 25 Dec 2021 22:58:29 +0000 From: Matthew Wilcox To: Uladzislau Rezki Cc: Manfred Spraul , LKML , Andrew Morton , Vasily Averin , cgel.zte@gmail.com, shakeelb@google.com, rdunlap@infradead.org, dbueso@suse.de, unixbhaskar@gmail.com, chi.minghao@zte.com.cn, arnd@arndb.de, Zeal Robot , linux-mm@kvack.org, 1vier1@web.de, stable@vger.kernel.org Subject: Re: [PATCH] mm/util.c: Make kvfree() safe for calling while holding spinlocks Message-ID: References: <20211222194828.15320-1-manfred@colorfullife.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspamd-Queue-Id: 65FB840038 X-Stat-Signature: 63r1ymhi44ens5rbzpcorugsgbf1wjry Authentication-Results: imf17.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=jMGiaPSB; dmarc=none; spf=none (imf17.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org X-Rspamd-Server: rspam11 X-HE-Tag: 1640473109-183334 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Sat, Dec 25, 2021 at 07:54:12PM +0100, Uladzislau Rezki wrote: > +static void drain_vmap_area(struct work_struct *work) > +{ > + if (mutex_trylock(&vmap_purge_lock)) { > + __purge_vmap_area_lazy(ULONG_MAX, 0); > + mutex_unlock(&vmap_purge_lock); > + } > +} > + > +static DECLARE_WORK(drain_vmap_area_work, drain_vmap_area); Presuambly if the worker fails to get the mutex, it should reschedule itself? And should it even trylock or just always lock? This kind of ties into something I've been wondering about -- we have a number of places in the kernel which cache 'freed' vmalloc allocations in order to speed up future allocations of the same size. Kind of like slab. Would we be better off trying to cache frequent allocations inside vmalloc instead of always purging them?