From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 86311C433E0 for ; Wed, 10 Feb 2021 07:16:12 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id D9DDD64E56 for ; Wed, 10 Feb 2021 07:16:11 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D9DDD64E56 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=nvidia.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 47CF46B006C; Wed, 10 Feb 2021 02:16:11 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 42CBB6B006E; Wed, 10 Feb 2021 02:16:11 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3424A6B0070; Wed, 10 Feb 2021 02:16:11 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0003.hostedemail.com [216.40.44.3]) by kanga.kvack.org (Postfix) with ESMTP id 1F0D86B006C for ; Wed, 10 Feb 2021 02:16:11 -0500 (EST) Received: from smtpin21.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id DDB68824556B for ; Wed, 10 Feb 2021 07:16:10 +0000 (UTC) X-FDA: 77801499300.21.55448DA Received: from hqnvemgate24.nvidia.com (hqnvemgate24.nvidia.com [216.228.121.143]) by imf01.hostedemail.com (Postfix) with ESMTP id 335AB20001DC for ; Wed, 10 Feb 2021 07:16:10 +0000 (UTC) Received: from hqmail.nvidia.com (Not Verified[216.228.121.13]) by hqnvemgate24.nvidia.com (using TLS: TLSv1.2, AES256-SHA) id ; Tue, 09 Feb 2021 23:16:08 -0800 Received: from DRHQMAIL107.nvidia.com (10.27.9.16) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Wed, 10 Feb 2021 07:16:08 +0000 Received: from [10.2.50.67] (172.20.145.6) by DRHQMAIL107.nvidia.com (10.27.9.16) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Wed, 10 Feb 2021 07:16:08 +0000 Subject: Re: [PATCH v2] mm: cma: support sysfs To: Minchan Kim , Greg KH CC: Andrew Morton , linux-mm , LKML , , , References: <43cd6fc4-5bc5-50ec-0252-ffe09afd68ea@nvidia.com> <7cc229f4-609c-71dd-9361-063ef1bf7c73@nvidia.com> <09e60732-6a46-dd00-f9d5-4ef17ee685c8@nvidia.com> From: John Hubbard Message-ID: Date: Tue, 9 Feb 2021 23:16:07 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:85.0) Gecko/20100101 Thunderbird/85.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [172.20.145.6] X-ClientProxiedBy: HQMAIL101.nvidia.com (172.20.187.10) To DRHQMAIL107.nvidia.com (10.27.9.16) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1612941368; bh=K1GI4vzcTOKbODiCg0dBY8yviaMSJzmK4ha7JjEbmZg=; h=Subject:To:CC:References:From:Message-ID:Date:User-Agent: MIME-Version:In-Reply-To:Content-Type:Content-Language: Content-Transfer-Encoding:X-Originating-IP:X-ClientProxiedBy; b=YO1EF6tByPwoH8IQQQ31SmU472GYHZiEnMBSvDdt7ll1DVTo+JJr2GvJpd/0h770L FvduHtjjdW143cQYhBwU1tjv8e4RL6VhdaSiPMN+424A0C0NgK8/TNZac9QRJB04Th rYooHFbl1MLO2HOiPmjRLyw14TCF69GsBx4xPmMv1tUaZMEQJP7e9o2s3k4Yqo3v/p wZp4C/TJ4exjMXZ696JdfezlL3JADUAKjJCNWM4COj/H2QReq8OwdL2gFZ8L1GNnKI NkcYFFBkJPB41wHpVcKyf6dIj1yk2/6+vSSlQFnA+BniRTqf/CJLtNn0JfWSHECiEC HISFltoCNMKbA== X-Stat-Signature: dr1u1bb1kfcsy8w3eim1i4yx856mp6mc X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 335AB20001DC Received-SPF: none (nvidia.com>: No applicable sender policy available) receiver=imf01; identity=mailfrom; envelope-from=""; helo=hqnvemgate24.nvidia.com; client-ip=216.228.121.143 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1612941370-356801 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On 2/9/21 11:12 PM, Minchan Kim wrote: ... >>> Agreed. How about this for the warning part? >>> >>> + >>> +/* >>> + * note: kobj_type should provide a release function to free dynamically >>> + * allocated object since kobject is responsible for controlling lifespan >>> + * of the object. However, cma_area is static object so technially, it >>> + * doesn't need release function. It's very exceptional case so pleaes >>> + * do not follow this model. >>> + */ >>> static struct kobj_type cma_ktype = { >>> .sysfs_ops = &kobj_sysfs_ops, >>> .default_groups = cma_groups >>> + .release = NULL, /* do not follow. See above */ >>> }; >>> >> >> No, please no. Just do it the correct way, what is the objection to >> creating a few dynamic kobjects from the heap? How many of these are >> you going to have that it will somehow be "wasteful"? >> >> Please do it properly. > > Oh, I misunderstood your word "don't provide a release function for the > kobject" so thought you agreed on John. If you didn't, we are stuck again: > IIUC, the objection from John was the cma_stat lifetime should be on parent > object, which is reasonable and make code simple. > Frankly speaking, I don't have strong opinion about either approach. > John? > We should do it as Greg requests, now that it's quite clear that he's insisting on this. Not a big deal. I just am not especially happy about the inability to do natural, efficient things here, such as use a statically allocated set of things with sysfs. And I remain convinced that the above is not "improper"; it's a reasonable step, given the limitations of the current sysfs design. I just wanted to say that out loud, as my proposal sinks to the bottom of the trench here. haha :) thanks, -- John Hubbard NVIDIA