Received: by 10.223.176.5 with SMTP id f5csp866775wra; Wed, 7 Feb 2018 08:46:36 -0800 (PST) X-Google-Smtp-Source: AH8x226ZOTwk4Uqaw9kzeHxf89mZOA+CTTu4HvgCHocCzGNdKVCvzjtBSy2w1QFj3GKvvX8hM3JC X-Received: by 10.99.106.202 with SMTP id f193mr5415767pgc.115.1518021996057; Wed, 07 Feb 2018 08:46:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518021996; cv=none; d=google.com; s=arc-20160816; b=OtbEJIaJ4jjoKsi/Bw7lLssttfmxt2hKcLjLJn/4V7wKlRgjDb9SwLaIY0gv+xPQ79 lQ+MjHum/y2E5mEjC+9qACVIvOEYXiaDq1FmjIWrBvypjx+/8uP+bz28R1ljT8sfW13O Jh8ZOgheSfP6v90XCysWBMynrK0aAj/e4evuc0eiDdRjgW4wirAeuFmvI6F/q86+84CO zBVYybGVnpdNVpMB6oW4ADsiO+7sD8f6cgGuYJVDjsPdtM3xHaFtscRod9U10KWc3Z8+ 5Hqi0hmCWLPpV1NmpuaWwGLZgDO1IAbyrafKDFUIqSwHKxp95hjmipOsYRmjntkrLlUd CScw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :arc-authentication-results; bh=uc4sp3uJNeDrP1LC7iuUxexzYXahlXUqCPE149ScD2s=; b=x8q8NsTfYaeFxi1uxFZjIR/6l3v2Cw8ArcGgKHwM03DuEnE8wqwM/bKJPOLlQna+CF tsnctfZWBy3qJrMEOvJEizLvWs2z8hG1iUXivjSu0ioD9D8P9q3NJgbJRUzdEA3yZz7N Wmo06XFTFnDFtCI25yaQYGE4TT211Y4qIjKIWWbEFWdP6hDFISvVOlaqFOn8Ks0Ww2EE QxWMpzL1IJVVlFGDXH+FbG/9X3ZlBFJgBXjMxHYHh+uQW8xMFH0A+034I5R7mMK8Ne7Q nVvhkAqo80jOYhoxxH0+3oUpJhaWNKADdKUA1akYnVgJNxD7nUHPybbj+Ksx5a+4cpgP 1eDA== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p17si1099707pgu.560.2018.02.07.08.46.22; Wed, 07 Feb 2018 08:46:36 -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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754696AbeBGQpZ (ORCPT + 99 others); Wed, 7 Feb 2018 11:45:25 -0500 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:57416 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754377AbeBGQpX (ORCPT ); Wed, 7 Feb 2018 11:45:23 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 13F6840201A1; Wed, 7 Feb 2018 16:45:23 +0000 (UTC) Received: from localhost (ovpn-200-34.brq.redhat.com [10.40.200.34]) by smtp.corp.redhat.com (Postfix) with ESMTP id 71BB01008563; Wed, 7 Feb 2018 16:45:15 +0000 (UTC) Date: Wed, 7 Feb 2018 17:45:13 +0100 From: Jesper Dangaard Brouer To: Steven Rostedt Cc: "Paul E. McKenney" , Kirill Tkhai , Matthew Wilcox , 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, rao.shoaib@oracle.com, brouer@redhat.com Subject: Re: [PATCH 0/2] rcu: Transform kfree_rcu() into kvfree_rcu() Message-ID: <20180207174513.5cc9b503@redhat.com> In-Reply-To: <20180207085700.393f90d0@gandalf.local.home> 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-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Wed, 07 Feb 2018 16:45:23 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Wed, 07 Feb 2018 16:45:23 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'brouer@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 7 Feb 2018 08:57:00 -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 > 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. For the record, I fully agree with Steve here. And being a performance "fanatic" I don't like to have the extra branch (and compares) in the free code path... but it's a MM-decision (and sometimes you should not listen to "fanatics" ;-)) void kvfree(const void *addr) { if (is_vmalloc_addr(addr)) vfree(addr); else kfree(addr); } EXPORT_SYMBOL(kvfree); -- Best regards, Jesper Dangaard Brouer MSc.CS, Principal Kernel Engineer at Red Hat LinkedIn: http://www.linkedin.com/in/brouer static inline bool is_vmalloc_addr(const void *x) { #ifdef CONFIG_MMU unsigned long addr = (unsigned long)x; return addr >= VMALLOC_START && addr < VMALLOC_END; #else return false; #endif }