From patchwork Sat Nov 21 04:49:50 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 329934 Delivered-To: patches@linaro.org Received: by 2002:a92:ae0b:0:0:0:0:0 with SMTP id s11csp446830ilh; Fri, 20 Nov 2020 20:50:00 -0800 (PST) X-Received: by 2002:a05:6a00:78d:b029:18b:f46:5262 with SMTP id g13-20020a056a00078db029018b0f465262mr17548981pfu.74.1605934200461; Fri, 20 Nov 2020 20:50:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605934200; cv=none; d=google.com; s=arc-20160816; b=wxAhEQWB3d25Fou2kKzz2C/E1UgsSEorH7lAUuYB5ZnoK5YhHCZPI9wHGOaLRLkeZJ mr6o1wzeg7YTP3Do+kZc7T+zQci2hSVOvT2O/QKwTugVp1Dob4xvRDXpXhrwxqIbnlgi PXt4S5YGuefWuEzBHfXANza7Cwcp+1NFmLkue8ochngYNNKMs8HVokXMo3lhYsH+zVZ+ RoaTijEStbeh32RsbpqZKw7xEVjkAG6Fv+0OdOpAjbwfrjNWoIVwVMdv5gVYOiyz1FY2 T4v/wmxRT/bOXPlbFPwKzKwKF4ILY91enMihMSfwV4vD7gjtGgFzcAOHR77RRc8IIuHN SDjA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:dkim-signature; bh=1dCpwtABCBAjt0w8Zd+Ad9bD2W4r2bOOZVX2c+Uu5fs=; b=F6HX7TyjmWxsc1vwvALvxLhRAAqLbX1cTVuGmjlL+p6aUqyIajwCPMD5BVDnBu6RNk fJ5Gr6gA+kCbom3vd6pkE2KPBW8jrrG4NOD4jHjY/yYhvQ4mUhUfRr3ouePSrGoo9Mi4 prBBj88eYL4sP1xTmaamsv/n9e1jz23Yg99SH4HGPorJFHmnbQufeKMKjlsr9aGATMsD zQNy3+U2r5Pw1vT3tEq/Xw5uik+JpZxOA/U5bXs8CC4OJTF2W9KBetm8X+uF2GHTlE8O dsI1ujHzSYKK3dGDkUrysbYBb7lTIfVYYsRH0zcLRYmGD7hXaTbB6IAX8fw2PoCaybxu bqWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dWZndGYY; spf=pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id s14sor2943509pjg.34.2020.11.20.20.50.00 for (Google Transport Security); Fri, 20 Nov 2020 20:50:00 -0800 (PST) Received-SPF: pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dWZndGYY; spf=pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=1dCpwtABCBAjt0w8Zd+Ad9bD2W4r2bOOZVX2c+Uu5fs=; b=dWZndGYY+uUFnjhTHmwgKC5kbCrdYmubSee+8hTXlbn/lIbOxvZ5Ttleyy46be1rVp qkjr2mvMwk7LjJWmsfxi3Q4PR6eFA0UA3aAUKtM4P2ZPe+0LcvmlhQcOgYPLkEdCIIzz wNJSVJ0EXPQ/HxHgOwIoeCjJqHxvAtGHQ7F4d2xt/aZfo3mkP4hHGzWSvOr7iTEJHtAj z93hcZeMjn9tZGTzsGiq6KvXp61nQQynOsvheETm4xBNBIa2RT0/JqqAsRTb3j63Rqx/ EMV0tlo39IeO6+VXs+9xIUNUCyxfoLQCYVohHcREV5xp0jF1u+vbO4uW4WRMeIFG5ZTl vHhA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=1dCpwtABCBAjt0w8Zd+Ad9bD2W4r2bOOZVX2c+Uu5fs=; b=fXq7Lry25VJ/oio0zAKw3PZlOdCHX/5GxhMWXiEHqU7PU8la+VdVV/SXvzfGJlyRtD yBKvY8rNTVnQQ4gPdnmdBOdHpir9o5Z6/hYnP3PQmaZRpECk90QuC1TsQ2ttpd/1ef+B MdKDk59WjiPHvFR29LvqeSHlqzzgC0JcjxXcFkrhEU+nRgJpIG4AQrfw00cVELDKZVHI tu0omHKPZIqlV78vkm4nAL0SCRm5AvL8uuLlK9ZkcnnC0ERusbUPZd9T3DM6lezqjcuu VkzUhr0Ky1oR6C0q38r+FlKiNPrm3uLemQj9SrqtIYlH+ClihJ03ak7Vn5KFeumrkTKU ZX8Q== X-Gm-Message-State: AOAM532ZfHyxyq/5mHWuDBSHHLnLLKpVjAuv+acUHGRdCYHjMBeMgLUN gAI9KVYaRB5xvCW1IMlVTR/E4O3d X-Google-Smtp-Source: ABdhPJyRE/0jIW/09/jq9G1nAs4OeW/5voPWRhKLPi853CLU1nhono7tAJRPn8bBZ4NkUjbxQj1OVQ== X-Received: by 2002:a17:90a:c003:: with SMTP id p3mr13414860pjt.221.1605934200086; Fri, 20 Nov 2020 20:50:00 -0800 (PST) Return-Path: Received: from localhost.localdomain ([2601:1c2:680:1319:692:26ff:feda:3a81]) by smtp.gmail.com with ESMTPSA id w196sm5407692pfd.177.2020.11.20.20.49.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Nov 2020 20:49:59 -0800 (PST) From: John Stultz To: lkml Cc: John Stultz , Sumit Semwal , Liam Mark , Laura Abbott , Brian Starkey , Hridya Valsaraju , Suren Baghdasaryan , Sandeep Patil , Daniel Mentz , Chris Goldsworthy , =?utf-8?q?=C3=98rjan_Eide?= , Robin Murphy , Ezequiel Garcia , Simon Ser , James Jones , linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org Subject: [PATCH v6 0/5] dma-buf: Code rework and performance improvements for system heap Date: Sat, 21 Nov 2020 04:49:50 +0000 Message-Id: <20201121044955.58215-1-john.stultz@linaro.org> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Hey All, So just wanted to send another revision of my patch series of performance optimizations to the dma-buf system heap, this time against drm-misc-next. This series reworks the system heap to use sgtables, and then consolidates the pagelist method from the heap-helpers into the CMA heap. After which the heap-helpers logic is removed (as it is unused). I'd still like to find a better way to avoid some of the logic duplication in implementing the entire dma_buf_ops handlers per heap. But unfortunately that code is tied somewhat to how the buffer's memory is tracked. As more heaps show up I think we'll have a better idea how to best share code, so for now I think this is ok. After this, the series introduces an optimization that Ørjan Eide implemented for ION that avoids calling sync on attachments that don't have a mapping. Finally, an optimization to use larger order pages for the system heap. This change brings us closer to the current performance of the ION allocation code (though there still is a gap due to ION using a mix of deferred-freeing and page pools, I'll be looking at integrating those eventually). This version of the series does not include the system-uncached heap as Daniel wanted further demonstration that it is useful with devices that use the mesa stack. I'm working on such a justification but I don't want to hold up these rework patches in the meantime. thanks -john New in v6: * Dropped the system-uncached heap submission for now * Rebased onto drm-misc-next Cc: Sumit Semwal Cc: Liam Mark Cc: Laura Abbott Cc: Brian Starkey Cc: Hridya Valsaraju Cc: Suren Baghdasaryan Cc: Sandeep Patil Cc: Daniel Mentz Cc: Chris Goldsworthy Cc: Ørjan Eide Cc: Robin Murphy Cc: Ezequiel Garcia Cc: Simon Ser Cc: James Jones Cc: linux-media@vger.kernel.org Cc: dri-devel@lists.freedesktop.org John Stultz (5): dma-buf: system_heap: Rework system heap to use sgtables instead of pagelists dma-buf: heaps: Move heap-helper logic into the cma_heap implementation dma-buf: heaps: Remove heap-helpers code dma-buf: heaps: Skip sync if not mapped dma-buf: system_heap: Allocate higher order pages if available drivers/dma-buf/heaps/Makefile | 1 - drivers/dma-buf/heaps/cma_heap.c | 325 +++++++++++++++++---- drivers/dma-buf/heaps/heap-helpers.c | 274 ------------------ drivers/dma-buf/heaps/heap-helpers.h | 53 ---- drivers/dma-buf/heaps/system_heap.c | 411 ++++++++++++++++++++++++--- 5 files changed, 640 insertions(+), 424 deletions(-) delete mode 100644 drivers/dma-buf/heaps/heap-helpers.c delete mode 100644 drivers/dma-buf/heaps/heap-helpers.h -- 2.17.1