Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp416803pxk; Thu, 24 Sep 2020 08:40:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwrQSFHwm37TELG5hdGmVRm9ir/GxF463ngUtN0aaM4nqvii+mZ/eYnGnt4MkMH2GJEb+NK X-Received: by 2002:a17:906:ca4f:: with SMTP id jx15mr492640ejb.454.1600962029144; Thu, 24 Sep 2020 08:40:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600962029; cv=none; d=google.com; s=arc-20160816; b=gQWBdC8YsuU1pWnRN/DttQ0wWd8zQhXREyOJ+4N6Frq1bon2cb0B4XQIMqpXwLOuF4 UM1vMmsNCqRg2yl+yKNWSoH2+rUgbPmExsir23hJGcy7Q6gDh28qq5hsn1wo/TsiYyf5 /aiEcAFGrBG+QQu2YTdJEPZRzQzhN0BeelK0yj5BZy97xodgcwdoj2t5EG77tzp/ui5N k+kWSB5vduqeUrY+zauLnB37chtRGlggVtZzBxWGGduoAMJnCtf8GffbCOz0NNsszLnd AAWKmpcsJYA8ZVV9dewv68wCxZ+ofZe8Tbhp8RvQZG67tHNaN4nZ2m9JDepvL3VglTR9 BcLg== 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=T2x549+PpWIkABY6nzLiNqCcv2DzFVVhDarJI9KMQdw=; b=EVLEbbl1oP8dbQN6FHsAUFL/3tIiWX4dAsiux3CPUDDMMlcUYDexnj5bKuIevnfWf+ i0NMEcumyIZFG03l1uUvaxoZ/tAV7JN+64X+MHI1+q5rFVXS4KxLqdGVVU+jzNjzpzZw BczpwOPTwL84xldpzFx66ksOBwPKth2W4YHYqYsByjs4a/UL2wUY4w8SUl0DOBQhDL6h m52HfFS5oCEgIOhLLm2XH3yChXbBwEqhsMcGp2wM4ZntQ45ZK6NckFeCffYoD7A4G7iw dYU85uejaV3cu904P9nLSaXckSZDcZno+VuZ9gFFx2+xM7h36cLniivKwdsz8x7ypWm/ vVrA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Buyy92eb; 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 v3si2193388ejx.520.2020.09.24.08.40.04; Thu, 24 Sep 2020 08:40:29 -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=Buyy92eb; 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 S1728516AbgIXPif (ORCPT + 99 others); Thu, 24 Sep 2020 11:38:35 -0400 Received: from mail.kernel.org ([198.145.29.99]:54352 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728139AbgIXPif (ORCPT ); Thu, 24 Sep 2020 11:38:35 -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 8105A221EB; Thu, 24 Sep 2020 15:38:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600961914; bh=z0bSE1PpsW/DNtkm7wsszU+8HwHLVybbm1u4JVedcis=; h=Date:From:To:Cc:Subject:Reply-To:References:In-Reply-To:From; b=Buyy92eb0jwKS/TTpBvg/MWMHPwLq7CPlTGEBnbCuva+0VbTTOVf+vH674sb5cYIH 2An1YWExAJGfDwLbGSHpd5qKlEJZ9uVUAThfi31MajHl1xw274Kl2Ur2Oq1Yl8rSoG rRvqHxQA6/pKL39qnpL4HlV/cOUfbAgUoIdmn7vI= Received: by paulmck-ThinkPad-P72.home (Postfix, from userid 1000) id 2A57835201B3; Thu, 24 Sep 2020 08:38:34 -0700 (PDT) Date: Thu, 24 Sep 2020 08:38:34 -0700 From: "Paul E. McKenney" To: Peter Zijlstra Cc: Uladzislau Rezki , Mel Gorman , Michal Hocko , LKML , RCU , linux-mm@kvack.org, Andrew Morton , Vlastimil Babka , Thomas Gleixner , "Theodore Y . Ts'o" , Joel Fernandes , Sebastian Andrzej Siewior , Oleksiy Avramchenko , Mel Gorman Subject: Re: [RFC-PATCH 2/4] mm: Add __rcu_alloc_page_lockless() func. Message-ID: <20200924153834.GW29330@paulmck-ThinkPad-P72> Reply-To: paulmck@kernel.org References: <20200921154558.GD29330@paulmck-ThinkPad-P72> <20200921160318.GO12990@dhcp22.suse.cz> <20200921194819.GA24236@pc636> <20200922075002.GU12990@dhcp22.suse.cz> <20200922131257.GA29241@pc636> <20200923103706.GJ3179@techsingularity.net> <20200923154105.GO29330@paulmck-ThinkPad-P72> <20200923232251.GK3179@techsingularity.net> <20200924081614.GA14819@pc636> <20200924111907.GE2628@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200924111907.GE2628@hirez.programming.kicks-ass.net> User-Agent: Mutt/1.9.4 (2018-02-28) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Sep 24, 2020 at 01:19:07PM +0200, Peter Zijlstra wrote: > On Thu, Sep 24, 2020 at 10:16:14AM +0200, Uladzislau Rezki wrote: > > The key point is "enough". We need pages to make a) fast progress b) support > > single argument of kvfree_rcu(one_arg). Not vice versa. That "enough" depends > > on scheduler latency and vague pre-allocated number of pages, it might > > be not enough what would require to refill it more and more or we can overshoot > > that would lead to memory overhead. So we have here timing issues and > > not accurate model. IMHO. > > I'm firmly opposed to the single argument kvfree_rcu() idea, that's > requiring memory to free memory. Not quite. First, there is a fallback when memory allocation fails. Second, in heavy-use situations, there is only one allocation per about 500 kvfree_rcu() calls on 64-bit systems. Third, there are other long-standing situations that require allocating memory in order to free memory. So I agree that it is a good general rule of thumb to avoid allocating on free paths, but there are exceptions. This is one of them. Thanx, Paul