Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp1641592pxf; Fri, 19 Mar 2021 11:49:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzzS1t7Zb9drKnycc9qzk3z0xUaOnG6HXslRVKqaOLHI3+lw0blfK8HsaPDXMHfHQZFU2p/ X-Received: by 2002:a17:906:2ac1:: with SMTP id m1mr6042324eje.472.1616179799302; Fri, 19 Mar 2021 11:49:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616179799; cv=none; d=google.com; s=arc-20160816; b=Ki8T0iYdqpfoZuVQ6F9IsYTL9GUwEbBL5+MIZ6FDfpXJtbdNxnXicDza2wRllrGvzl HidC3e8FyFepoGgqMzwoVg4qRqis3Fg6nG8rduJIbSW+pRR435Eso+AZQGeV1mVXCw1/ r2DUoZasid68r75P+YsYPtSMWncCmzhuzDxpG85fmQ7PMXKWSwMMvHBIXNQAQCpweBq5 xtylHJRNNQ3ERDhC466fJR5chODubKgFyZ2v+ap6uF3pfQhmRECVE5mKryAaEEmR8DaT zf8zUrxqT+WG/AiWWdhz3QTJcprO3GXv3TuwHgeb0lpg0s/pzmv/jqQKaZL5FEfSB/Ad 3Ejg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=yYYW5DnVy84/4kP9GQaKkhK/K8GjeKuwEY0DFeSN6Tg=; b=smRsvFhMwL1x+XNiGEStpwI+SIV2j1rfeSSTxEXwnnbDqi7I5UP0wrC7ZLQt0sjqoZ vTCgJ3b540TMn3J2tt/p6kA8tK3SLxr8FrZcmoVMXeX6769pQ7KAz4v5vzL5OcmFneOA rpJmIuKfXDZsdHS0iXuiLiJKtoWkrYCqxQv0jhD89PexIvBTOvfNQv3dHlasFt1ozbWw DCzx/9jbMcVsEIW3MwhQB28XN8s71KtVmJ4xgHDWU3Sn8iziWbxW8zpJDqPM0BESwhoD AbMKEvamOz7Gvtk/kucic8aFrER1866p7GUlJv1YK5Rn1oCQGbOtTGdFAZatugf91uxj vILg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=JTkd1Wij; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id cb21si5019405ejb.170.2021.03.19.11.49.37; Fri, 19 Mar 2021 11:49:59 -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=@gmail.com header.s=20161025 header.b=JTkd1Wij; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230057AbhCSSsn (ORCPT + 99 others); Fri, 19 Mar 2021 14:48:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54958 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230259AbhCSSsQ (ORCPT ); Fri, 19 Mar 2021 14:48:16 -0400 Received: from mail-lf1-x136.google.com (mail-lf1-x136.google.com [IPv6:2a00:1450:4864:20::136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4895DC06174A; Fri, 19 Mar 2021 11:48:14 -0700 (PDT) Received: by mail-lf1-x136.google.com with SMTP id b83so11516649lfd.11; Fri, 19 Mar 2021 11:48:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=yYYW5DnVy84/4kP9GQaKkhK/K8GjeKuwEY0DFeSN6Tg=; b=JTkd1WijALfGVwHAIoHlFxO8p7v7gsY+v3XsU4ro23Xiuebo+6inwyLeom2X3oieeR Rxbht7CJ9Cph507VFPJyZCyfBvXEDvxP4DDgrQupKDDvoY0SXyX7oFdES54kUaFcKOSf KMF+M9SMWxPRD87A4nUsCQaoqQMtxMuweDb1qhZCK67kH68m89fjECpPs82IPsD/4q7G 9A8B++/bytkP118iuQBWU27wQN0BsODSkIDVUnCSqD4X63mwLwopetQrQajalwBSP2Ch ve8nkl3nzABqJUBkXLw55WpYmTKsS2+w9zJEMYEBtoFwXxujuI3FxMAujL0UPr9W/q/a OrWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=yYYW5DnVy84/4kP9GQaKkhK/K8GjeKuwEY0DFeSN6Tg=; b=IIzsbn1amkzi4xxG6niNcD+OTwijRhg58xQbWXL7E6WVzW5+PXGAaralApIKLZbIm4 l2Je7Cvq7AJfvxdvzbbGcp8YmcMRzPEdmHKZRE7XKrE9Mc+bcFqPpbdOd2YKRb4Ppk+7 J0xCexkoasAvBYPnZZbCE8Nx+TfTCdyNmNZWZUOwnM/XLqiCfGp1xh1+l4AXbWfJ9Yd9 UnCIdAd66wr6LY45HO3Wvn1qJn2dxKkwu/F6dvydGSCp4jVGcnNl3DwHz2bQdGPxHmal r/ch2DMuy9SJwFw1B+qmmLzv1ozsizXqUBEoaAKN78W69u+TY+WQRG/WhAQBMIHfGUEi oCBA== X-Gm-Message-State: AOAM533ckLtWSXYNClAhny+UULZ1O/uITPXx4qjn+dcUMIFaw0VL2Do7 CxYauctRNwipK+Z2/FnIwX6p83wmPIc= X-Received: by 2002:ac2:454d:: with SMTP id j13mr1586740lfm.129.1616179692482; Fri, 19 Mar 2021 11:48:12 -0700 (PDT) Received: from [192.168.2.145] (109-252-193-52.dynamic.spd-mgts.ru. [109.252.193.52]) by smtp.googlemail.com with ESMTPSA id j8sm871890lji.8.2021.03.19.11.48.11 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 19 Mar 2021 11:48:12 -0700 (PDT) Subject: Re: [PATCH v4] mm: cma: support sysfs To: Minchan Kim Cc: Greg Kroah-Hartman , Andrew Morton , linux-mm , LKML , joaodias@google.com, willy@infradead.org, david@redhat.com, surenb@google.com, John Hubbard , Nicolas Chauvet , "linux-tegra@vger.kernel.org" References: <33ec18ef-8652-643a-1a53-ff7c3caf4399@gmail.com> <78883205-e6da-5bc4-dcec-b6eb921567b1@gmail.com> <72db59eb-75dc-d1ed-7a83-17052e8f22a8@gmail.com> <071c6681-f492-2c94-5686-30c30778f39d@gmail.com> From: Dmitry Osipenko Message-ID: <007c0317-8819-a6b8-fdff-c0b5899c4f51@gmail.com> Date: Fri, 19 Mar 2021 21:48:11 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 19.03.2021 21:21, Minchan Kim пишет: > On Fri, Mar 19, 2021 at 08:56:06PM +0300, Dmitry Osipenko wrote: >> 19.03.2021 19:30, Minchan Kim пишет: >>> +static void cma_kobj_release(struct kobject *kobj) >>> +{ >>> + struct cma_kobject *cma_kobj = container_of(kobj, struct cma_kobject, kobj); >>> + >>> + kfree(cma_kobj); >>> +} >> >> Oh, wait.. I think this kfree wrong since cma_kobj belongs to the array. > > Oh, good spot. Let me use kzalloc. > Thinking a bit more about this.. it looks like actually it should be better to get back to the older variant of cma_stat, but allocate at the time of CMA initialization, rather than at the time of sysfs initialization. Then the cma_stat will be decoupled from the cma struct and cma_stat will be a self-contained object.