Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp773335pxb; Tue, 2 Feb 2021 18:15:58 -0800 (PST) X-Google-Smtp-Source: ABdhPJyVhlu0xUCUOwwXahhah47IfA4Dxun2DECsyMohleHEk9rK5PzrwnoDE+Td8vv+8pxfmwt6 X-Received: by 2002:a17:907:7295:: with SMTP id dt21mr931551ejc.518.1612318558617; Tue, 02 Feb 2021 18:15:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612318558; cv=none; d=google.com; s=arc-20160816; b=flaw8Qtw7+BnTjd7jT1vFzSax24SEEFreiAs/N/iyjrS9/sT842SM3dFofU0/uH4Tz WJIGTFZdn3HoT+bqdyvqSHHvvw/isA8A7DurXfhZUb9g4vT0qdRE4MESO2lFYxrQM1mw BV6RiR3B/6hGSF8vjSvQzWzkYq44p8KcHcIcd/GPCLGB9aZxFuF5dU9ZJkN61bJOiRMM y6zTAG/lWVB8y1uMcG9zW2MdTyBkdMTPGB7dOk++0VQK6VyDFAj1zb3c7LwIeaniX/jF zHlq1Ge+DcrUf7yHI5hyd4yy8T5gcu/jraTStIG6ICQupBKRHmuTwHHyeSEteQVUKJrG bjfA== 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=+vYDps8/+IhHaSDG5kMjkWUxFJUq2DFUOYgi2VmWXtI=; b=0B/fuvzzXDnr+jxb4GQMt1dpzEjlp0w7XK/T2IscrHqSlvHuOphpnRpmRYaVC4cSDr FiB92R8Vv9qtYB7A2Cx7eAwg8qpfrpb6s2S3Qag+5yHKIeVzBlu8IQ8+QjAuurxczane u1azqBqp0H19JioJtvXFdU5iMbLZ17141xZEVZdBEbEWFZNau7fQ9YhhGNBNmQqm4S4T Y4hkoZ1DJZYn9Uk/Gjwxdo9Ik8r5ICuG4k+uWGz/bfZpsH6pQk15NdnhQoUX0PUEHhI2 DYGJNDrxjnupQCDvcQ8wRgMxnQBpf8bs0f5p4UfgrjRryxjwI2bUiFFSfFObv9x4SEUM kbag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=QT34eaYN; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gz12si451124ejb.550.2021.02.02.18.15.33; Tue, 02 Feb 2021 18:15:58 -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=@google.com header.s=20161025 header.b=QT34eaYN; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231617AbhBCCOX (ORCPT + 99 others); Tue, 2 Feb 2021 21:14:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38334 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229889AbhBCCOT (ORCPT ); Tue, 2 Feb 2021 21:14:19 -0500 Received: from mail-wr1-x42c.google.com (mail-wr1-x42c.google.com [IPv6:2a00:1450:4864:20::42c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F23E7C061573 for ; Tue, 2 Feb 2021 18:13:38 -0800 (PST) Received: by mail-wr1-x42c.google.com with SMTP id d16so22416618wro.11 for ; Tue, 02 Feb 2021 18:13:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=+vYDps8/+IhHaSDG5kMjkWUxFJUq2DFUOYgi2VmWXtI=; b=QT34eaYNV8fBLXWs/JBogWNBxvdF8ywloFrclidxZLbMY42rIDA48Y8pWRzaRg5kyn cJA/Pz4LjH28NykDdh27Y+YDF2VA1ob27B9AmZ+b+y8eFiRD3fKog+kSs9ztUIQwluk5 G5LsE1Hmui8HoXHVY8szdjd48rhhZA4JUPeSSoXEZMxzn3bocg+h4SnDsxruSuxRv9QT bTpIhgtjAyR+m3tKilxDCcEYtYANNdJ3CrpkPwfxvl9JzsXtY4jEpaPrHe4emg1kiNRY Tub23wpwxyjLb6730Xg39sU0NDx1RWY4HzKlBzNT+btC4Ta9Vj6gI7TYaH3+g8P5rtUU HPRA== 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=+vYDps8/+IhHaSDG5kMjkWUxFJUq2DFUOYgi2VmWXtI=; b=PCKujtzXexMWrbmNvIbNpBLI6xz89Zx93GU2CpMSjZHPIPn3MsDuVLU2RadpWy0PvW seF4Jk4r1GOJy0Pz7zTLgTb+/Rv/RZvTzNIIrlTBYDCe1rmNo3zBT/uDGUTJ0oxqvDxH fHiIO/7GVM2uG9Hgna7XmOHs11Xjir94VzfHt7cIha0RSi/SC2A5NfvVMSCrvcAH090p 1MtegE6rSLbb5W+S5Scm9q4WYtQeuRL1bw7/4qYudbdJTzj3E8ITbBM6mogixOn606eY mFQ5Nh0JUh1WBJHweqyN+C2nEqI+vmQ/rbdZBabRZ3TstmI7p1AppfcNXiqItg52DJrv VcyA== X-Gm-Message-State: AOAM533BGfSEt3ydPbrHBPOtqt9vEDdydSfr4Ew7hOMVahouTQLWl7Kv TfCcNxhvbrIac0PC6MkavnHCcv4VbearUkMfng4BWA== X-Received: by 2002:a5d:453b:: with SMTP id j27mr895948wra.92.1612318417595; Tue, 02 Feb 2021 18:13:37 -0800 (PST) MIME-Version: 1.0 References: <20210203003134.2422308-1-surenb@google.com> <20210203003134.2422308-2-surenb@google.com> In-Reply-To: From: Suren Baghdasaryan Date: Tue, 2 Feb 2021 18:13:26 -0800 Message-ID: Subject: Re: [PATCH v2 2/2] dma-buf: heaps: Map system heap pages as managed by linux vm To: John Stultz 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 6:07 PM John Stultz wrote: > > 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? Good question. Let me look closer into it. > > thanks > -john