Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp771006pxb; Tue, 2 Feb 2021 18:11:29 -0800 (PST) X-Google-Smtp-Source: ABdhPJwykcRAHgbvATgUDF5nUhr5wG/QjnjBEThzjsd0gLZ3h4ZIIHV39uolLeQNjwG8tJiC1BJL X-Received: by 2002:a50:fd84:: with SMTP id o4mr880194edt.340.1612318289355; Tue, 02 Feb 2021 18:11:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612318289; cv=none; d=google.com; s=arc-20160816; b=ymFPGJ2I/wnnxpYKA0cfFfqt6GHn2dM7E0lDm0d2G15MFgYkvgqrhFoXTTHthuNM9K yed+KmrNR5LpnW32Ky9CmZ8t6zLCPfgXV2rRxtfKkbSNe218i6QXLWvaf1HtC8cWDNAK 6fTiK4x/BsCpAjnpm5DUlK/9WF6AXuBITclBo+826CMvB8D+kedkx2QUqUzFr/S/wuSq qA+PsKrzO9JKBck6mR+AMXC42mm9M0gHG5FQFGvKyjdpgIwTdctDjhyWgJWv1ZZ0BLw/ E/Oex7SmxhDZVcJIMm2TndlJDIWfs6Ge4bvUyWXUzqLm0m+n/3NoWyenZo/RvSIasX37 /oQw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=ayzfcSfxCvzlRbstGP9hGkgIcQ5hx1YuU1pxX+bWuHs=; b=tnE7aUl2AUTSlujN/htDNcigiGd+Ho3sI3E1g4HQidv4SW9esU6+ijAlEmJHrtfI0w ebnRbgpKx/gzU9Rrv91Tdi4KvSnu9k7hakrPtVcDlnQc6krVba2TqqMYcdhP5c9NRFbp EM3lN2ZRxMfVGTiFOZJ9k1HkdNFwsBWU1wXFqydEk9/z4hTrAZKPgt83oybc0SRv4436 VFeXbchiQFbdtW2JDHvn7hzVWhjDkF+J9DmJgZHXc040jqymqAMHHG39azi3ZzBGRT2C HONYkETE6RZJ2XFMgwbBAMvlj9FTPebkAWbgmeB73seeYwYQ4XLIJ0jlFcsqC0WPNo+D 2VSg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=eGlil+w2; 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=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g23si428734ejo.55.2021.02.02.18.11.02; Tue, 02 Feb 2021 18:11:29 -0800 (PST) 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=@linaro.org header.s=google header.b=eGlil+w2; 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=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231284AbhBCCIc (ORCPT + 99 others); Tue, 2 Feb 2021 21:08:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37092 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230134AbhBCCIb (ORCPT ); Tue, 2 Feb 2021 21:08:31 -0500 Received: from mail-lf1-x12a.google.com (mail-lf1-x12a.google.com [IPv6:2a00:1450:4864:20::12a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 395B2C06174A for ; Tue, 2 Feb 2021 18:07:51 -0800 (PST) Received: by mail-lf1-x12a.google.com with SMTP id a12so31104277lfb.1 for ; Tue, 02 Feb 2021 18:07:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=ayzfcSfxCvzlRbstGP9hGkgIcQ5hx1YuU1pxX+bWuHs=; b=eGlil+w2DCwQD8KK1xRdq7AIVCuqHRf5q1ar8b/Fy9tkCbGJE8I1o9Qh9anhQO2hK9 xZmfjyfzF11eyHCvfh+oppTiW9/Xd1whsALSsj6vTiIjxqVyHaq3TV6bPu9hHW0k9y4E Cr2aFpB7ctiPfw+uWvahloZr+9eLF1MS6oRzP9XcHmFnx5EJc5khMz4vtafLlo2Rttda mQsJCiB4acmtmbiR7l0NS4lcvNKZK7ks3LGsQhkW0ctj4/iD3jp2/yPnn21S2B/fvdvm k/9L97xrZ36XRy3b1hTg6XmL3zJNXAiUgdCzJG/Aw1DV2xr1LsWaEybvLB6qFi3fliAC PFXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=ayzfcSfxCvzlRbstGP9hGkgIcQ5hx1YuU1pxX+bWuHs=; b=aAqBttwjdfPkN2bg1RWUNKcEnYkPyVPAGyHJO5RYD/MKP+2QA+/c1wIX6gMflX159F sge23q5Y1WmivjkO1QSkEBBIU2nGLwG82NtoAbRIJdxbLpnTH349h+7wt7KjXl/KopkZ gIPJ7hpv9fLizPi4EP54NCwHek3vxXKg6Ol7/6RrpGvWKzqmOntMHZHSYOhQEiWZ8+4P Oo479OGO+iAUKs3COYagTsdTvMARhS3PZnQYOw2w9ID/WgiUk5T6unzjefxh6mfFdLQ+ Ly5oNiFyYUwLSjTwPIyBePp4qaVL7DLt0ceq8LKKGykKrYgJchTJlXvy3Ulp4e8t1aGb HQXQ== X-Gm-Message-State: AOAM530jNJy0OmhTAJtCN+e3kkfZ/+p0x/0+/q4zLqYp7AGENpofBQya b+JUpswwJe1CMWPNz3yPMGu1fyktqKKQM+yDL9xrYA== X-Received: by 2002:ac2:5590:: with SMTP id v16mr454568lfg.626.1612318069555; Tue, 02 Feb 2021 18:07:49 -0800 (PST) MIME-Version: 1.0 References: <20210203003134.2422308-1-surenb@google.com> <20210203003134.2422308-2-surenb@google.com> In-Reply-To: <20210203003134.2422308-2-surenb@google.com> From: John Stultz Date: Tue, 2 Feb 2021 18:07:38 -0800 Message-ID: Subject: Re: [PATCH v2 2/2] dma-buf: heaps: Map system heap pages as managed by linux vm To: Suren Baghdasaryan Cc: Sumit Semwal , Andrew Morton , Christoph Hellwig , Liam Mark , Laura Abbott , Brian Starkey , Christian Koenig , Chris Goldsworthy , =?UTF-8?Q?=C3=98rjan_Eide?= , Robin Murphy , James Jones , Minchan Kim , Hridya Valsaraju , Sandeep Patil , linux-media , dri-devel , "moderated list:DMA BUFFER SHARING FRAMEWORK" , linux-mm , lkml , Android Kernel Team Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Feb 2, 2021 at 4:31 PM Suren Baghdasaryan wrote: > Currently system heap maps its buffers with VM_PFNMAP flag using > remap_pfn_range. This results in such buffers not being accounted > for in PSS calculations because vm treats this memory as having no > page structs. Without page structs there are no counters representing > how many processes are mapping a page and therefore PSS calculation > is impossible. > Historically, ION driver used to map its buffers as VM_PFNMAP areas > due to memory carveouts that did not have page structs [1]. That > is not the case anymore and it seems there was desire to move away > from remap_pfn_range [2]. > Dmabuf system heap design inherits this ION behavior and maps its > pages using remap_pfn_range even though allocated pages are backed > by page structs. > Replace remap_pfn_range with vm_insert_page, following Laura's suggestion > in [1]. This would allow correct PSS calculation for dmabufs. > > [1] https://driverdev-devel.linuxdriverproject.narkive.com/v0fJGpaD/using-ion-memory-for-direct-io > [2] http://driverdev.linuxdriverproject.org/pipermail/driverdev-devel/2018-October/127519.html > (sorry, could not find lore links for these discussions) > > Suggested-by: Laura Abbott > Signed-off-by: Suren Baghdasaryan For consistency, do we need something similar for the cma heap as well? thanks -john