Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp2551703pxk; Sun, 20 Sep 2020 08:08:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwfLA46DFmvGslbLgkDlZISZHGyt4knSMGZIfO/IHDcwmpURQ/ZMvbEgEXI8FMsaAgk5q5T X-Received: by 2002:a17:906:7489:: with SMTP id e9mr44808084ejl.154.1600614486206; Sun, 20 Sep 2020 08:08:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600614486; cv=none; d=google.com; s=arc-20160816; b=ZXyLXwmYkn/PZs0W/nxY1D1L1K4jlNlsfUZV4Au+RS6psxp2NMnPTweN5AL89GMAn5 OMZmgNmQ1cZQSHFxmDzGvbCXcIj50MHkS23dvOkvYCGmto9yDcEtiDNwk/T0B0bRGv/B G7T2koRCeD8nAcApUZjiTkzHnAXYNNg/3yFxs4eipcatZpag8vMZLkXiRq7359b5RQmd Ojf3lLW5wqXpv7jrflu5YXi0o2g7KbCiRgvD2QmcqHIuH+lXBiZOOXPUwsCuZLTCLVcs 3y78pntczjQeqoN8rd09Z48F0VsvcSn95pyIzNRgyxOsQC5M+b8gbsmCE+4zAvYHu/8h RliQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=0QIYYwQL1y5/z1eYGfZlUb5wybofpQUmhVW3rxiMPuk=; b=QQ8eZIVzGB4Va4qzitJHBB//jh3TgmoDHbfohGVYhkP+acn9PGvcW92BJF6MWeDGvp /AvtY61tVLcKv+1GWg7fREVoXhiMo+Qh/7HNa5lFR3SP521FD0/pUPcHanbwoH9YpHXW 0dA9vuKzQjiq4dVZgsXbRw6IxfDi3MOSndmXYNXjUHBq9ay0w/Xi7uUs31oJu4stB2vQ 5i3ddAasHRDnTJ9B5ZbnCiU2vXfpZnR9WIT6dzG8KNRKMNH3Xr15hsRgc90YMtZm7/c/ MjeCEstC7SEXptgOLV63IE/Wv33aBrtd/nDSAYsOrX7/RCkpDf02BZhGULUxU431o9o6 grZw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=n7OiQ5Aj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id di23si7186131edb.451.2020.09.20.08.07.43; Sun, 20 Sep 2020 08:08:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=n7OiQ5Aj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726344AbgITPGj (ORCPT + 99 others); Sun, 20 Sep 2020 11:06:39 -0400 Received: from mail.kernel.org ([198.145.29.99]:51246 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726305AbgITPGj (ORCPT ); Sun, 20 Sep 2020 11:06:39 -0400 Received: from paulmck-ThinkPad-P72.home (unknown [50.45.173.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 88EB620870; Sun, 20 Sep 2020 15:06:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600614398; bh=eF+JnFq4iVQVzHR+dMxoT/cJJg+WxK5PierVQVgRRow=; h=Date:From:To:Cc:Subject:Reply-To:References:In-Reply-To:From; b=n7OiQ5Ajr9+bxOXjvsZ6IMErGgjMDEFMnIM26xvZQnPPFS5bPusrTEDIBbMaWaf7O DDeVviN3WVgAWeqp8LC5sZgdSQpeBX268cpMAV6fmQGqVuZTyignednhIkIotoKuXh zUhfOeuO6i8cvW52oHTFVStN6UO71OdL8kJRwKMw= Received: by paulmck-ThinkPad-P72.home (Postfix, from userid 1000) id 587FC35227C1; Sun, 20 Sep 2020 08:06:38 -0700 (PDT) Date: Sun, 20 Sep 2020 08:06:38 -0700 From: "Paul E. McKenney" To: "Uladzislau Rezki (Sony)" Cc: LKML , RCU , linux-mm@kvack.org, Andrew Morton , Peter Zijlstra , Michal Hocko , Vlastimil Babka , Thomas Gleixner , "Theodore Y . Ts'o" , Joel Fernandes , Sebastian Andrzej Siewior , Oleksiy Avramchenko Subject: Re: [PATCH 4/4] rcu/tree: Use schedule_delayed_work() instead of WQ_HIGHPRI queue Message-ID: <20200920150638.GA5453@paulmck-ThinkPad-P72> Reply-To: paulmck@kernel.org References: <20200918194817.48921-1-urezki@gmail.com> <20200918194817.48921-5-urezki@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200918194817.48921-5-urezki@gmail.com> User-Agent: Mutt/1.9.4 (2018-02-28) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Sep 18, 2020 at 09:48:17PM +0200, Uladzislau Rezki (Sony) wrote: > Recently the separate worker thread has been introduced to > maintain the local page cache from the regular kernel context, > instead of kvfree_rcu() contexts. That was done because a caller > of the k[v]free_rcu() can be any context type what is a problem > from the allocation point of view. > > >From the other hand, the lock-less way of obtaining a page has > been introduced and directly injected to the k[v]free_rcu() path. > > Therefore it is not important anymore to use a high priority "wq" > for the external job that used to fill a page cache ASAP when it > was empty. > > Signed-off-by: Uladzislau Rezki (Sony) And I needed to apply the patch below to make this one pass rcutorture scenarios SRCU-P and TREE05. Repeat by: tools/testing/selftests/rcutorture/bin/kvm.sh --allcpus --duration 3 --configs "SRCU-P TREE05" --trust-make Without the patch below, the system hangs very early in boot. Please let me know if some other fix would be better. Thanx, Paul ------------------------------------------------------------------------ diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c index 8ce1ea4..2424e2a 100644 --- a/kernel/rcu/tree.c +++ b/kernel/rcu/tree.c @@ -3481,7 +3481,8 @@ void kvfree_call_rcu(struct rcu_head *head, rcu_callback_t func) success = kvfree_call_rcu_add_ptr_to_bulk(krcp, ptr); if (!success) { // Use delayed work, so we do not deadlock with rq->lock. - if (!atomic_xchg(&krcp->work_in_progress, 1)) + if (rcu_scheduler_active == RCU_SCHEDULER_RUNNING && + !atomic_xchg(&krcp->work_in_progress, 1)) schedule_delayed_work(&krcp->page_cache_work, 1); if (head == NULL)