From patchwork Sat Nov 21 23:49:57 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 330059 Delivered-To: patches@linaro.org Received: by 2002:a92:ae0b:0:0:0:0:0 with SMTP id s11csp979783ilh; Sat, 21 Nov 2020 15:50:05 -0800 (PST) X-Received: by 2002:a17:90a:17a2:: with SMTP id q31mr17178604pja.51.1606002605630; Sat, 21 Nov 2020 15:50:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606002605; cv=none; d=google.com; s=arc-20160816; b=lwqoont5UnoPE84ysSgNXUMY/PPnytULW1/Npdu57zaPswLWc1QwCSVJbqbK0zrZSF 37ADhCnNnmjWsi5sUG8SfQigi2Vz480SR5pQxy5PPuUQpugftx2LSfewMw9AkRwe+AZk GmlCcRAtLfYwdv8SnTiARHK/FVm1T7w+dOIScvJTa4mhQSbsNnIhBm9mR/aDFyaV0FOl AcahVjm0e98+L4YU6f69tAplUJ1e8mvvLfNSL60AfDfVnaRCqWH7rQdnGeDLoWiYcKXJ t3aNbA20jMnF59A8jTrBAOdpnLNXsZbYkw1vwRB1J0wPi8LjL4MC1uqFdzZGd/g+6Nar cR1Q== 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=ZdyhTvyVNa2fhAy8X/NHf9i/vBLLU68LSfcoVNt03w8=; b=bR4c9nutijFOr//urCyR4QIDkav3VzqRZdHcxFD+JEXLP+jFNpR7mdED/VGZiFtGiE /Gycn9MctbnRbH3QlTvA2sFQk66MCn8D8HS+okXqv2cxH2KboAOVtX3j4dfvx86EZwe0 5jBr294v8ZEg/GCJLex61ABodAVwb/E889prNz7sRwOW8VlX8v9dQliE8sQStt4MLD7P lsaJb/eaYCpUpMQ/IUZ3TMhPEtY7NqszxDbRcOpO2eYYb/zi1sUp/1TKaKbTerlCiBE/ DzwULSF1vreLT/xXTwy8hcmiQtvyAVCUVPJ5PK2PBqC5WARJQ4QqUswoEdR1xefmT0EU MMgw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=hPqnU3xO; 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 z2sor4119362pjl.19.2020.11.21.15.50.05 for (Google Transport Security); Sat, 21 Nov 2020 15:50:05 -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=hPqnU3xO; 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=ZdyhTvyVNa2fhAy8X/NHf9i/vBLLU68LSfcoVNt03w8=; b=hPqnU3xOMWcdHJxE2WBRuowx+pM6mR9po/NLZ2+HG9as2e0p2M4myMeqQ/bGXW7Mbf UAWBA5y72Sp07u1lRw3WoZlKIL9cb+4evqy3TEfUDr+clyQZCY7zsQbuRU6b0ZPQQQvA IkkCVaWOdcm2RvBBlh4m/JbjuoP/iltPQqln9mW4DeT6sIfVW08ry4X6SFhunJGoIO9t oK5HD1kteNpl83ql4n46c9fETkwM61Yq2I0ezzIHwzUvVDHR+AOmki884xaCWssQzM0M rtWP6LIGU/d8apzl2D0Ah64PN4+rZ4kV5GBpA4JUlGTfYIPpcFCYhBUP1fYJetSy9l/w jOEA== 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=ZdyhTvyVNa2fhAy8X/NHf9i/vBLLU68LSfcoVNt03w8=; b=gO9bzXSu+myDLdKhDfdd39KhPuM4gHpxG1Q7I8qG9KpIO234BQ4yUaEiOYtWJfpBq7 1lAd2zwbwGZH0lH0bTyhnd9uqaRGht+y8gNjrsM5TAKVkepFZ2EC74vgzy7BqXrSxv2I i7S2McPYGc8FeKnbKqUhY5PVFsHXANRvVtR9O8PrxDK7K8txqoRBDgZ1wxEThjHdatBY XfLYUFBMjp2vXxFmhThduMKR8b6+CnnDhYKlTLvOw2eD+4KC1ixAnw3VUuXUNQ8mIcJV PmN9G9VTydz9hstWgPZ4FF1I4ph9B+NUoaoKRHVF/bV3P4rPH0Mpy0Mkcmtt8ik1VtUO Fasw== X-Gm-Message-State: AOAM533DpR9vzaxO90DlKnavkp+XCSF549uSOac7q94WTVF2CcuHDu9g 7DeNiI27XoV4eq7gyqXSEKPV8voN X-Google-Smtp-Source: ABdhPJzR7eE8aKla6W64xhedCSmbj1FTLdSO3fp593xPplEFC+UFeaGglpeDqZNua7/tdBZdBDBHuw== X-Received: by 2002:a17:90a:1d47:: with SMTP id u7mr17839921pju.49.1606002605188; Sat, 21 Nov 2020 15:50:05 -0800 (PST) Return-Path: Received: from localhost.localdomain ([2601:1c2:680:1319:692:26ff:feda:3a81]) by smtp.gmail.com with ESMTPSA id v126sm7882525pfb.137.2020.11.21.15.50.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Nov 2020 15:50:04 -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 v7 0/5] dma-buf: Code rework and performance improvements for system heap Date: Sat, 21 Nov 2020 23:49:57 +0000 Message-Id: <20201121235002.69945-1-john.stultz@linaro.org> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Hey All, So Sumit noted a flub I made in adapting the last series to the new dma-buf-map code that is in drm-misc-next. Thus I wanted to send this (hopefully) last revision of my patch series of performance optimizations to the dma-buf system heap, once again 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 v7: * Fixed the incorrect adaptation to the dma-buf-map usage 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 | 329 +++++++++++++++++---- drivers/dma-buf/heaps/heap-helpers.c | 274 ------------------ drivers/dma-buf/heaps/heap-helpers.h | 53 ---- drivers/dma-buf/heaps/system_heap.c | 414 ++++++++++++++++++++++++--- 5 files changed, 647 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