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.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,INCLUDES_CR_TRAILER,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED 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 6FDA7C433E0 for ; Wed, 3 Feb 2021 01:39:29 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id D4F6C64E39 for ; Wed, 3 Feb 2021 01:39:28 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D4F6C64E39 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 40B476B006E; Tue, 2 Feb 2021 20:39:28 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 393B66B0070; Tue, 2 Feb 2021 20:39:28 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1E73B6B0071; Tue, 2 Feb 2021 20:39:28 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0053.hostedemail.com [216.40.44.53]) by kanga.kvack.org (Postfix) with ESMTP id 01FB56B006E for ; Tue, 2 Feb 2021 20:39:27 -0500 (EST) Received: from smtpin25.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id BF7AC180AD802 for ; Wed, 3 Feb 2021 01:39:27 +0000 (UTC) X-FDA: 77775249174.25.B7D6A66 Received: from mail-pl1-f176.google.com (mail-pl1-f176.google.com [209.85.214.176]) by imf09.hostedemail.com (Postfix) with ESMTP id BBFBD60001A1 for ; Wed, 3 Feb 2021 01:39:26 +0000 (UTC) Received: by mail-pl1-f176.google.com with SMTP id d13so13563785plg.0 for ; Tue, 02 Feb 2021 17:39:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=XIYaotR9cVz0dZkIxPzlPF8z5N/cDZctzyKFUN0dyY0=; b=cXvYlwrI6hfAyLYI+VmHQVQQhLu2PXgyoCiLpjHxw4UxkHfexWxOgUdgUW1MnTD2H/ ntSjl0I5N9XmHiEfPfzHzGi+CTkSytba/uqkzTrUbc7UMxjn3pAvr+yrGkXTI44sUI0X 9JzN8XpI1Gy5EamBEPB7N2MCyMl2yR+5l0IENR5kl8l4FoUnOFNf1k2RnDJvm7irT+QB dSKydTAjlcwL3ukWk/UgaC/dOmNnxuyXkbnEfwnV1bTNzh3BMI73eO3ipiQr23jBYCzC 2vK1mxCvX2O77vR3QD9SE4/tDIbWSSBVcUbUiK6NHAMJn/2hjlQlID/4oN9t7PbsKSe6 EwVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to; bh=XIYaotR9cVz0dZkIxPzlPF8z5N/cDZctzyKFUN0dyY0=; b=kylmvlv9qyXlcFiRa4ttx0XAVk2ntZLuIAYqbIt5vYgbCzyRo5A5HqsgCCsFh0o9ZC O6XkTa8TQFdU8fIgjoQdJ7hqIuh7cVV4DwNm9f82khU60wVqNaJkvhlDKK1hDtH91TJ5 /mCCALMuYTIAUUnktdzMwp0JDU6WvMo3vK0fAaImMSTQW9v4fhd3deJKMn9XsjM3Bayx DQz8ZSeK/VrmOgCcH72xy27zBCCTuoMrpnV8NqjtwFMWNnaC0bZtlrUwjdLC4yMC4W+Q zQnuFcqO4+W901IGs/g7kAtXAHL7/Xee2l8fJ2Jo2a1fD48QEaEPs4FMV5arAErT6vyB BTlA== X-Gm-Message-State: AOAM530ArPisfbg39jGR6LiZTfa+IYE6qXULwTUDezFgFU26gNXcjx43 zxawg3DDPD1zumcpY16qvbw= X-Google-Smtp-Source: ABdhPJw4+TJeBM73IhpaxHBiQrVir31ns6RnIpgpHmpCk5j9tXDdCMTWEfxafjtp+R5KhfwTy9JIuQ== X-Received: by 2002:a17:90a:8906:: with SMTP id u6mr664117pjn.223.1612316365454; Tue, 02 Feb 2021 17:39:25 -0800 (PST) Received: from google.com ([2620:15c:211:201:1502:84f8:ffc3:45b]) by smtp.gmail.com with ESMTPSA id m10sm217140pjs.25.2021.02.02.17.39.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Feb 2021 17:39:24 -0800 (PST) Date: Tue, 2 Feb 2021 17:39:21 -0800 From: Minchan Kim To: Suren Baghdasaryan Cc: sumit.semwal@linaro.org, akpm@linux-foundation.org, hch@infradead.org, lmark@codeaurora.org, labbott@redhat.com, Brian.Starkey@arm.com, john.stultz@linaro.org, christian.koenig@amd.com, cgoldswo@codeaurora.org, orjan.eide@arm.com, robin.murphy@arm.com, jajones@nvidia.com, hridya@google.com, sspatil@google.com, linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org, linaro-mm-sig@lists.linaro.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, kernel-team@android.com Subject: Re: [PATCH v2 2/2] dma-buf: heaps: Map system heap pages as managed by linux vm Message-ID: References: <20210203003134.2422308-1-surenb@google.com> <20210203003134.2422308-2-surenb@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210203003134.2422308-2-surenb@google.com> X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: BBFBD60001A1 X-Stat-Signature: 6ew1b6jzia7dcn1a7enfr14h9w7rubkj Received-SPF: none (gmail.com>: No applicable sender policy available) receiver=imf09; identity=mailfrom; envelope-from=""; helo=mail-pl1-f176.google.com; client-ip=209.85.214.176 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1612316366-824305 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 Tue, Feb 02, 2021 at 04:31:34PM -0800, 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 Reviewed-by: Minchan Kim A note: This patch makes dmabuf system heap accounted as PSS so if someone has relies on the size, they will see the bloat. IIRC, there was some debate whether PSS accounting for their buffer is correct or not. If it'd be a problem, we need to discuss how to solve it(maybe, vma->vm_flags and reintroduce remap_pfn_range for them to be respected).