Received: by 10.223.176.5 with SMTP id f5csp839830wra; Wed, 7 Feb 2018 08:20:19 -0800 (PST) X-Google-Smtp-Source: AH8x2240uBiy0EHyYtQcoPk7Mp9BgQDmfpgVP3elok4ezcX9pzNy4xQVHiW4lEZYhJ1x6NW5CveB X-Received: by 2002:a17:902:a9cb:: with SMTP id b11-v6mr6563769plr.315.1518020419060; Wed, 07 Feb 2018 08:20:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518020419; cv=none; d=google.com; s=arc-20160816; b=t7tGL3i0fknsO3Qp1XOt40zaJCI9AxEOvvmF2Z3J7X4eWGGx+4hWSLp6wQpg7iKnIm I43Sg2J5k+3HJ8kj9XzfMCk4wBZg2Jllb4wwhf1au/jkJ0lKCuZQJiOdf7VGSjBPYvh/ ASTeMYkHpP1reVjh8AgZ5SR3Fk0ZsREVqlW2yZQofEpeWDuLvy06bY1LRcn+OUbHoVEc Gnhnsj80cVQgwtWuzGQdIxmlSELw3wEULHXqsnQ8Ky6U/HyINmO4eQO44ERrcB7mnSrM iXfMSWeftN+qG24TDW2CnM18Ubz0P7XaxifPiJgofdGHR71fzTetkOzVCZYkslKByWQo tfhA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=Os8sxT2mADbk/2eOsr1FpRmNmjnA5cqc+QmsZNsog4U=; b=ECanDbp4JhM6RRoMVDkDFOZ1NTKJzDU8xs3T//TFqaoHpSo52abOMlIeS0fgBTGu12 uRIt1pDV09Z4byQeHKS+BW2drCaIazVSNa+G8hmEZpr8nine6SU+SVH7GsM4ttJoHuRH dlEBggbfcE9bTj6j1AD0QzTYIuHfMZvo7I8N1PzZcHAlsoS/uuwhaNTkFuhhp7PogWLX 0EbCiMv//vb5uoI30QLU6XJUtn5PkCbxUduD9eqRx1u2NHJvZKAD65E1AozXC0Ll9jCQ R/LTAiYAeAuprgR+5Xd93tHC6YLn4Cai/MSZSqGY7nNStl5p9dNLWolQguzzZd2EY8tr g5Dg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=CisZF13S; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d24-v6si1276450plr.243.2018.02.07.08.20.04; Wed, 07 Feb 2018 08:20:19 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=CisZF13S; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754654AbeBGQTB (ORCPT + 99 others); Wed, 7 Feb 2018 11:19:01 -0500 Received: from bombadil.infradead.org ([65.50.211.133]:51685 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754392AbeBGQS7 (ORCPT ); Wed, 7 Feb 2018 11:18:59 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.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:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=Os8sxT2mADbk/2eOsr1FpRmNmjnA5cqc+QmsZNsog4U=; b=CisZF13SZCRxjPi9vn9UZ5f5k eEUrDpdDwosieqbHUdkpupx8825PG/Jgt/QljgR/72hGFH6VBiTJk/uOfoQ5t2sRql6T/wzC/Simh NIBu0u4/3nOdhoVojzGnayZAoqhW598W9SAVPPlnU+noWrvQgjETwXMQGJ+CBYfpbq2Ww3bA+Wqh7 kqxdVuyWKtxZG6sCHBVqs0MRJYvn4hVGrb5PvZky4GJSGkzUhMjdDp0ekkKfITyl++4sWLadqvhrT DDrbL0+g2LWObHQ9/DulzIEhLPvcREd28Gs9KinzahPIjiWn1mL3kvN5no0IWj/JLyBRTMZgLf0iG 4EOa4NoDw==; Received: from willy by bombadil.infradead.org with local (Exim 4.89 #1 (Red Hat Linux)) id 1ejSQo-0006Ib-Vb; Wed, 07 Feb 2018 16:18:46 +0000 Date: Wed, 7 Feb 2018 08:18:46 -0800 From: Matthew Wilcox To: Steven Rostedt Cc: "Paul E. McKenney" , Kirill Tkhai , josh@joshtriplett.org, mathieu.desnoyers@efficios.com, jiangshanlai@gmail.com, mingo@redhat.com, cl@linux.com, penberg@kernel.org, rientjes@google.com, iamjoonsoo.kim@lge.com, akpm@linux-foundation.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, brouer@redhat.com, rao.shoaib@oracle.com Subject: Re: [PATCH 0/2] rcu: Transform kfree_rcu() into kvfree_rcu() Message-ID: <20180207161846.GA902@bombadil.infradead.org> References: <151791170164.5994.8253310844733420079.stgit@localhost.localdomain> <20180207021703.GC3617@linux.vnet.ibm.com> <20180207042334.GA16175@bombadil.infradead.org> <20180207050200.GH3617@linux.vnet.ibm.com> <20180207083104.GK3617@linux.vnet.ibm.com> <20180207085700.393f90d0@gandalf.local.home> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180207085700.393f90d0@gandalf.local.home> User-Agent: Mutt/1.9.1 (2017-09-22) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Feb 07, 2018 at 08:57:00AM -0500, Steven Rostedt wrote: > On Wed, 7 Feb 2018 00:31:04 -0800 > "Paul E. McKenney" wrote: > > > I see problems. We would then have two different names for exactly the > > same thing. > > > > Seems like it would be a lot easier to simply document the existing > > kfree_rcu() behavior, especially given that it apparently already works. > > The really doesn't seem to me to be worth a name change. > > Honestly, I don't believe this is an RCU sub-system decision. This is a > memory management decision. > > If we have kmalloc(), vmalloc(), kfree(), vfree() and kvfree(), and we You missed kvmalloc() ... > want kmalloc() to be freed with kfree(), and vmalloc() to be freed with > vfree(), and for strange reasons, we don't know how the data was > allocated we have kvfree(). That's an mm decision not an rcu one. We > should have kfree_rcu(), vfree_rcu() and kvfree_rcu(), and honestly, > they should not depend on kvfree() doing the same thing for everything. > Each should call the corresponding member that they represent. Which > would change this patch set. > > Why? Too much coupling between RCU and MM. What if in the future > something changes and kvfree() goes away or changes drastically. We > would then have to go through all the users of RCU to change them too. > > To me kvfree() is a special case and should not be used by RCU as a > generic function. That would make RCU and MM much more coupled than > necessary. I'd still like it to be called free_rcu() ... so let's turn it around. What memory can you allocate and then *not* free by calling kvfree()? kvfree() can free memory allocated by kmalloc(), vmalloc(), any slab allocation (is that guaranteed, or just something that happens to work?) I think it can't free per-cpu allocations, bootmem, DMA allocations, or alloc_page/get_free_page. Do we need to be able to free any of those objects in order to rename kfree_rcu() to just free_rcu()?