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 0F586C433F5 for ; Tue, 25 Jan 2022 16:50:24 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 77D416B00B3; Tue, 25 Jan 2022 11:50:24 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 72AAD6B00B5; Tue, 25 Jan 2022 11:50:24 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 600FF6B00B3; Tue, 25 Jan 2022 11:50:24 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 4C3436B00B3 for ; Tue, 25 Jan 2022 11:50:24 -0500 (EST) Received: from smtpin25.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 07BEE182111BD for ; Tue, 25 Jan 2022 16:50:24 +0000 (UTC) X-FDA: 79069397568.25.9BA0BAA Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf08.hostedemail.com (Postfix) with ESMTP id DE850160040 for ; Tue, 25 Jan 2022 16:50:22 +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=VrBKWP0akaG4dIR083DmtTNeX0gnAazEE+UlofwJtug=; b=G47DpRhQzRKnkRExVce/bUy461 Jgz4K6JpXmFTSsjjSe0zJnvC9QTgJaXueYe6LFLVjds6/Wl/IxEmFpQUy+cg0HSFE11QewCZmMK9G VwLAvsOo5GqTyvHeTryUXb3x9Hj7Qk/AP6q9wkUi0h6mB83BJj2p5r74CRqwrREy1WOpFg5WYaVyv HQKyJoF4v9/03plFZqfs5BI5osKC2QcXq/VaSZaKgfA6iEIJ9dA93ITE/TqzTls/m71S+K5VprCTx bqcK75gtqUrjNgzKE+qAEC0eLcH0HCEcpov9zt27oAubhQ9RyYrq1eZEkcbZnDDArW3jv86+SK10g gxT8P/eg==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1nCP1K-0035c0-8b; Tue, 25 Jan 2022 16:50:14 +0000 Date: Tue, 25 Jan 2022 16:50:14 +0000 From: Matthew Wilcox To: "Uladzislau Rezki (Sony)" Cc: Andrew Morton , linux-mm@kvack.org, LKML , Christoph Hellwig , Nicholas Piggin , Oleksiy Avramchenko Subject: Re: [PATCH v2 1/1] mm/vmalloc: Move draining areas out of caller context Message-ID: References: <20220125163912.2809-1-urezki@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220125163912.2809-1-urezki@gmail.com> X-Rspamd-Server: rspam11 X-Rspamd-Queue-Id: DE850160040 X-Stat-Signature: q5abjsz8ito8ocrwge8cyktcfptoy9ib Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=G47DpRhQ; dmarc=none; spf=none (imf08.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org X-Rspam-User: nil X-HE-Tag: 1643129422-737934 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 Tue, Jan 25, 2022 at 05:39:12PM +0100, Uladzislau Rezki (Sony) wrote: > @@ -1768,7 +1776,8 @@ static void free_vmap_area_noflush(struct vmap_area *va) > > /* After this point, we may free va at any time */ > if (unlikely(nr_lazy > lazy_max_pages())) > - try_purge_vmap_area_lazy(); > + if (!atomic_xchg(&drain_vmap_work_in_progress, 1)) > + schedule_work(&drain_vmap_work); > } Is it necessary to have drain_vmap_work_in_progress? The documentation says: * This puts a job in the kernel-global workqueue if it was not already * queued and leaves it in the same position on the kernel-global * workqueue otherwise. and the implementation seems to use test_and_set_bit() to ensure this is true.