Received: by 10.223.176.5 with SMTP id f5csp348961wra; Tue, 6 Feb 2018 23:58:35 -0800 (PST) X-Google-Smtp-Source: AH8x226romNUqNSCvFPUouC7PPf3ZkwrQ8kJcrNXcL9nfS0MwqxGiDqFkYwdyUc8uQDi2R26gMaF X-Received: by 10.101.96.215 with SMTP id r23mr4158301pgv.139.1517990314968; Tue, 06 Feb 2018 23:58:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517990314; cv=none; d=google.com; s=arc-20160816; b=LHLXzPHkT2qBaa70OkNPC69mV8LhUhCr+JlGuVLXFyi8Fb4TdMKqhQu3+afeKvXrQc 2WzQBRvKS2SBX5wzZPqVbpchRd52J5xl7rsHXa0hdCXlfNCfuUnvXXmylFsHugyJ72Cg 0m8SqnaQ/LMSFfuCno2SaA71nyPbSYuFNIcpznbSSYWGWun3KHtA6NGUmBJ4QNcxplsp 7Byg/99lNpBBb+0RmohEZ3jpBUsgHq76KLHkJAaxXKvbTeN94SBbSvaMDGjZT3qK0FmW MbOWXFGLOZq+q1wZFQ5r5nljPAECxFShOunQDSO3El/sBbalSqRotSlgaF+EGck/KNGI wjtg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:spamdiagnosticmetadata :spamdiagnosticoutput:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature:arc-authentication-results; bh=QldSeduQH5TS7bDPQGnIp+EvDgbTZUfGQpXA916z/c4=; b=ZnDm6K8WCET/MntwzTFlRjg4HBVT+TtFnzun1vhOELj2TPKG8QOl8ZiCHNA0fdgXVB 4MZBIRVreKro12d/Hf2G6tC8X9W3YglMiiEj5FbMcdcB9KY8zhMRgJXCBeUAC9/KXbPy 0ILiRTP2J9BEAsrVrjH1kWrP6gZuoQGZMNeQqgG/b3lJ5xBRPDX4iakzzPfecz0kJyiz 3ZVBoi05drktEnIXXHtyBPD/DiGy0ATRAN2V4l9yMeIw/VtdEb9XHF0Rat/nrnla5F1d u8vyY2Q9GpVfMGEQILVW1ktFa0XLhxrHuD5qDXjjjtZrMADWadXGQPSFJ7plWCszEjVO 3jYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=selector1 header.b=W0OX5jzR; 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=pass (p=NONE sp=NONE dis=NONE) header.from=virtuozzo.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q19si615973pgc.307.2018.02.06.23.58.20; Tue, 06 Feb 2018 23:58:34 -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=pass header.i=@virtuozzo.com header.s=selector1 header.b=W0OX5jzR; 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=pass (p=NONE sp=NONE dis=NONE) header.from=virtuozzo.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753409AbeBGH5j (ORCPT + 99 others); Wed, 7 Feb 2018 02:57:39 -0500 Received: from mail-ve1eur01on0116.outbound.protection.outlook.com ([104.47.1.116]:42144 "EHLO EUR01-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750815AbeBGH5h (ORCPT ); Wed, 7 Feb 2018 02:57:37 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=QldSeduQH5TS7bDPQGnIp+EvDgbTZUfGQpXA916z/c4=; b=W0OX5jzR8FPLvT2PKQE53pUI7o2MgDMF1ozQ3kirY6gGsiabhiZ5fPtDrVHqEI/6pWwNONobsX+X3WekmgDyyt4fxS4UIMK1DfyNvUWszSQ15SmlrlPeavsyauBDJkdjja9BBg3iyFBnJWJXs1TH9hRJMQihnn8ABjHHvmTsZtw= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=ktkhai@virtuozzo.com; Received: from [172.16.25.196] (195.214.232.6) by HE1PR0801MB1338.eurprd08.prod.outlook.com (2603:10a6:3:39::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.485.10; Wed, 7 Feb 2018 07:57:33 +0000 Subject: Re: [PATCH 0/2] rcu: Transform kfree_rcu() into kvfree_rcu() To: paulmck@linux.vnet.ibm.com, Matthew Wilcox Cc: josh@joshtriplett.org, rostedt@goodmis.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 References: <151791170164.5994.8253310844733420079.stgit@localhost.localdomain> <20180207021703.GC3617@linux.vnet.ibm.com> <20180207042334.GA16175@bombadil.infradead.org> <20180207050200.GH3617@linux.vnet.ibm.com> From: Kirill Tkhai Message-ID: Date: Wed, 7 Feb 2018 10:57:28 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <20180207050200.GH3617@linux.vnet.ibm.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [195.214.232.6] X-ClientProxiedBy: HE1P189CA0022.EURP189.PROD.OUTLOOK.COM (2603:10a6:7:53::35) To HE1PR0801MB1338.eurprd08.prod.outlook.com (2603:10a6:3:39::28) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: d71ddee2-bf82-4d3e-ccff-08d56e00729b X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(4534165)(7168020)(4627221)(201703031133081)(201702281549075)(5600026)(4604075)(2017052603307)(7153060)(7193020);SRVR:HE1PR0801MB1338; X-Microsoft-Exchange-Diagnostics: 1;HE1PR0801MB1338;3:qq1ex+4xKfPY3pzcC9TE1/Hy5zpjr+Lt80lgo2hVgnrypoDuVf06dig1h4nQp7nZ0pA2tc1O1YZZlKVd/Y3FhHn1Xm1Zxlu2Z2msB899prW9oKtVIgcbiH0IjqneHPYsALqQd2Mu/ZSTazZ35IebEHa3FqJ0XrZM/aCZLZatmp3R5IDjOLvf7FkLxdemUuEMrPut39pvMzt1YtOI+rMHQBNx5cbaENiXBPlV3gYxvaRXfP8PSgV8xX8A6UYMFAF9;25:KbDxcjW7pqPCEZIh1LM5kXLYbMEg9pJ/jo5Nhf+imp68vREa8TmrCZOnlnobKT9QkMUbAnCd4/BIwNkLZtSKsUDrtRrNih95able51/xwfla8nBxSVNsJ4E6Bl2wBoIiahp9oPS4JPzpKMyBFGwO7/YLexfRy2wZIU5Tv3eHBRNNnwi7QKUQdPhpub1GrROoF7qAgSfAGwbJLbIaZWPQuwmz6nwE04vRxJ4zZBlSSmU2TRpEJ+esW2YhY3fWLg4hfFLi7T9yPbY3FtU2ITgIc4kFERRxbj3PyOBsMwhEYnYK3lXAZp+lgRNsO++t3oQUNjX77gSOPt/nis27GUPpTA==;31:QVXoyXcY7Q4t5EvgiQnQCa6AFb+CD5AOm95VP5pY21u0ophV4cy9bUoOfyylljsurs4PQgSHW5bYC0anYBEEE+xBd8XN/aYdp4ifsUXTb/xUoPa8YclLLoR+cMEY0aDtuHWYEF+SZhB+mPuXogTcyAgAznF+JKqjAZnuBY71ZCMq0RDo/En5VSBCdsXGnt3PVPM/Lp9jFhpgBpccRMUgMCZmpX3MAKYbSA/27hlz4tk= X-MS-TrafficTypeDiagnostic: HE1PR0801MB1338: X-Microsoft-Exchange-Diagnostics: 1;HE1PR0801MB1338;20:HrVtVDu0zyx//XyNIcDe0Fc4VfJ6ftT7k7iJg2w8mG1aRH/Gg8L38P9zDEyeQVgZJ/F2K71CDf3R8O0hhNyKg/6NaZIHcysO09CyagVEWirJCEyFua/JgTDdyBauOS1J7VlCezTtybR51tt62+pVkmdnFznO4y++v+HaQSWforuPHGSv3D4kw5QETVi6Xf8Zzmr7rv9cR5JxhjP8wxmXaE/UoPMgPumy3Vh4RRQdUE4aLdQ85A79Ca3dY0YXCvVpX8lpDKSfzwtv1Rfz7gCmjFgSzXbKOchKAmBv3oM9CwgxhchI7WfSlIeZMO8i9iSXSmYTAUc46U7pD26mJs6B3W4TOQoRCaCHTeVHjUMXwioTXxIdi4U3VO1UKEPGLcyny5G+OVFOs3kjzQlgs/KM4C1uAhOlcXHm9vRBcHKUUEo=;4:5/eYqs2XlgwC7B0xkXOED6KcBVJ8pXYZNJBXCBd1VQEtCnmpCiazNLODKZOsLEHZXTV4h6Qj35a6jdKH9tjzeOIr89PnuBpSIL0RfaYrBuOZRx2ns6PXmkrvLyeaLtJYqUizy9tbJFzUvzdeTOyT3tlVGvlTAucVjwjajrVXSMxtt7X9Jtc+FcRQFZ1tc6k+DZsk80WuxQkgNhAduy6q6rJYBvn8lzxpzmY//emakk6w5ZgafiR+qHsczpntl1oUlh3P4kfNS0ILSw4B1SMEHA== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040501)(2401047)(5005006)(8121501046)(10201501046)(93006095)(93001095)(3002001)(3231101)(2400082)(944501161)(6041288)(20161123562045)(20161123558120)(20161123564045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011);SRVR:HE1PR0801MB1338;BCL:0;PCL:0;RULEID:;SRVR:HE1PR0801MB1338; X-Forefront-PRVS: 0576145E86 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(6049001)(39380400002)(376002)(346002)(39850400004)(396003)(366004)(199004)(189003)(65956001)(66066001)(16526019)(4326008)(2950100002)(6666003)(6916009)(64126003)(6486002)(93886005)(25786009)(186003)(6246003)(50466002)(97736004)(86362001)(229853002)(81166006)(31696002)(36756003)(230700001)(8936002)(68736007)(105586002)(53936002)(39060400002)(478600001)(7736002)(106356001)(7416002)(55236004)(76176011)(53546011)(316002)(52116002)(26005)(8676002)(386003)(2486003)(52146003)(23676004)(77096007)(58126008)(16576012)(5660300001)(81156014)(47776003)(65826007)(65806001)(3846002)(6116002)(305945005)(2906002)(31686004)(83506002);DIR:OUT;SFP:1102;SCL:1;SRVR:HE1PR0801MB1338;H:[172.16.25.196];FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; Received-SPF: None (protection.outlook.com: virtuozzo.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtIRTFQUjA4MDFNQjEzMzg7MjM6YTR5R0Q3c2IvYzhEeWp6R3JHRXI1bjFt?= =?utf-8?B?ZVhhTUdkdW5xWHRsMmQvcDFFTGI2V3lEb0ZpZGdMN25vdTl1bEliN1VHM1Ex?= =?utf-8?B?RFJVZExUR0pFai9zd2lOczd0US9Ed3VtVTE0SmlYcnVzcFkzUkFUZGEweTVG?= =?utf-8?B?c1FLZlJqeTBSNjNPWFNrTXZvOTlDT3BDNXVXcklOaG1kMnpzU3Ntck0reEFS?= =?utf-8?B?SkVZRUZQT2hSNG44MllHUXpzYXlLQy9HdzViNStwUE5Pb3F6d1B2TENyalRO?= =?utf-8?B?QVVwU3NRLy9XeEhub1k3VTh5KzhnNFo1TDdkQVdGT2pYUG9VNU5GM3paOU1s?= =?utf-8?B?VjU4YXZtRTRkaThSZ0tNQ3JCN3Z4OXlTbFRPbGVMbDltSXFER3NQNStaaFhQ?= =?utf-8?B?UnQ4bjVWYTA0bmhqQWY4MzdZTEVFcGNjaFhMcFp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D2iJsur41hyPAvQ9TC3+EolfE0ZlyhUrMLi6AY4x9MX9QQfWIAkzTM6PHf+qET1ewcbgKx8DkaJE=;5:+q38wcEKjZdFf2TC1/YfMY82P15gHn8NKKnEbNTeahQuL7JfI9DeKH6WTM8uhZz9Z9U0JZpNMl5h8JMrf4jaOV4XPZ7olOl7uMwxbVk4r7/JpZqWLdqWXcPQFYkId3aFm+kq7r5XArY/14mkD6vWBblSqpolWF49yoNtlDmJQTk=;24:YIOEaiAJpPQxdGz8OyVPZwYhMSBEsen2bkvWtgIO8zb3ZNn2TUblyTAxFxjw8Laa2hngLv/uZxBFQ2zKtb3vfSM/W8rXTmdeBfn+RDpC62Y=;7:/7kFZ5zB1bEoVOTQtr6237EYVs4EvW3B1P6QUjJlzuLhIvwH5H5vy6pTA39x6n4nQu0s3ynQo47CqclayMI0hoOBGy6jB15PN8g/2dI8F4VqGM5oDyIXMb+DyzCsh0sdIABR73CldKTgaPOn/l6XlE0QZngLHPFpaZqng7cxtMk6jPq6BNVwhAvgvGIoDtgSYkRj8VIvghnxIvv8C7WsOQ37ZGN8CLbWD1buLOCmt8yfaksIjhg74btM0gkCG3ZP SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;HE1PR0801MB1338;20:oRsY9ddjsKb2plm2yqTYFnLKjTi5wx3cxkt/OXtFfA23/x4Hm2hyHcjHT2CggKK/58P6D9/GTqEox1pVzxwEnrvNKn9uUyMgQBSDcIXC96qw73N+0te9aycvU5x8QNiEdO4ar0fgiW7YPq7Ga5bb5D1VVgCOQ/4rN5Z5pkPRAqE= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Feb 2018 07:57:33.9036 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d71ddee2-bf82-4d3e-ccff-08d56e00729b X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR0801MB1338 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 07.02.2018 08:02, Paul E. McKenney wrote: > On Tue, Feb 06, 2018 at 08:23:34PM -0800, Matthew Wilcox wrote: >> On Tue, Feb 06, 2018 at 06:17:03PM -0800, Paul E. McKenney wrote: >>> So it is OK to kvmalloc() something and pass it to either kfree() or >>> kvfree(), and it had better be OK to kvmalloc() something and pass it >>> to kvfree(). >>> >>> Is it OK to kmalloc() something and pass it to kvfree()? >> >> Yes, it absolutely is. >> >> void kvfree(const void *addr) >> { >> if (is_vmalloc_addr(addr)) >> vfree(addr); >> else >> kfree(addr); >> } >> >>> If so, is it really useful to have two different names here, that is, >>> both kfree_rcu() and kvfree_rcu()? >> >> I think it's handy to have all three of kvfree_rcu(), kfree_rcu() and >> vfree_rcu() available in the API for the symmetry of calling kmalloc() >> / kfree_rcu(). >> >> Personally, I would like us to rename kvfree() to just free(), and have >> malloc(x) be an alias to kvmalloc(x, GFP_KERNEL), but I haven't won that >> fight yet. > > But why not just have the existing kfree_rcu() API cover both kmalloc() > and kvmalloc()? Perhaps I am not in the right forums, but I am not hearing > anyone arguing that the RCU API has too few members. ;-) People, far from RCU internals, consider kfree_rcu() like an extension of kfree(). And it's not clear it's need to dive into kfree_rcu() comments, when someone is looking a primitive to free vmalloc'ed memory. Also, construction like obj = kvmalloc(); kfree_rcu(obj); makes me think it's legitimately to use plain kfree() as pair bracket to kvmalloc(). So the significant change of kfree_rcu() behavior will complicate stable backporters life, because they will need to keep in mind such differences between different kernel versions. It seems if we are going to use the single primitive for both kmalloc() and kvmalloc() memory, it has to have another name. But I don't see problems with having both kfree_rcu() and kvfree_rcu(). Kirill