From patchwork Wed Aug 25 18:30:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 502309 Delivered-To: patches@linaro.org Received: by 2002:a02:6f15:0:0:0:0:0 with SMTP id x21csp863830jab; Wed, 25 Aug 2021 11:31:04 -0700 (PDT) X-Received: by 2002:a17:90b:b03:: with SMTP id bf3mr12318117pjb.15.1629916264452; Wed, 25 Aug 2021 11:31:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629916264; cv=none; d=google.com; s=arc-20160816; b=ojK41WU4CFJv4kK/vSt5kLv3ySIi7WMfWfi2Q+iGJuPu6EGtF0MLprGT9hOY3v4yKp Ff9OqpPf/xds5Ha0w9XUkGa3SPt39QLCi5pdPhu4sY0b+3+NjSWGOoDAyrV9EXEKgN/K EngOkMCZDgWbVyAVsOBrGha0JWx1VMcrC5N+OHcYfm+jXPa6mRwgRhIE2i1JnBRrIes7 cCcmyImPmNtr0BtRHZewaq5fv4qffIzDE5VMRuQkA37GAmLkvWTagGuiHDtaxgDplSRO wEWZZjL+0NrlFjAvJP7dSwiYzBfXG0KwLObEYrMIIsEv6qm1rzAWXjv11S7Bi+69mCOb raHA== 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=Qfk6BSvcgBI7Pc/jE3YW7xZmx9KCBB6EdbOOmvrD6Qc=; b=btR/tkMGKR1LXEERF1JQcAK6NkTdtb1xGC3WaPhshLsaeK69A1C23osmYwhNoZYgoo zzJnP/WL0+lhwvtswWHXpjCnD+U3EccfmHeyntxFgUgxGkFHsWnZQACZeR8MGM9+7rHb ww7dz/l2grqgOl8Lobse3XMVODhUTXT9pdx9ZH0NCEp4uBCv1136sFdKr63pHCgwQfOD rRxK/LFzELqylmM1COjxCW8qSkghvWke4GhOQSXo1WIH/as0U8wAUNBKlgkzMSZFGhRV POOzvlfm/+O5HyK8/6wREkAKN0/qp0jytPu9rHu3BocAzWhSod7Wa01CS44iNXMF8x8a 8Fmw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="o/kwIS9r"; spf=pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.41 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-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id g8sor3651234pjl.11.2021.08.25.11.31.04 for (Google Transport Security); Wed, 25 Aug 2021 11:31:04 -0700 (PDT) Received-SPF: pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="o/kwIS9r"; spf=pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.41 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=Qfk6BSvcgBI7Pc/jE3YW7xZmx9KCBB6EdbOOmvrD6Qc=; b=o/kwIS9r/jytIoTEBqNyRfm1IR4OcGddRWAo+yF9fpQLIb+9crwAo912mpdNTPka7k jEua+cYFJcUHhwXbdudbENPFHXpuVrdJGkBWbMgP8Yv3O9J1NT+qE4YQBsMDrHss0aZZ mATbCEQd0H2F5LDvP/Q+3vnLxXjVKghXtt5BkXNTr5o5yFTuj94hQvHvGCIfSZVCb4mK 0ADz6SCGJEbjL0NoMsqBC2DXVteR88Zr8uklUMYOT1vFoR1QGC+VhR9OuTG6p8+OIto0 BtmIqhLO9WQ4QLXP+gcM1TbJmvC7qhoC8xFqXKlb3PObbxREqOe3oodksIkkajQ6e2ku nR+Q== 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=Qfk6BSvcgBI7Pc/jE3YW7xZmx9KCBB6EdbOOmvrD6Qc=; b=eQ9efQ2EJbYP3ay2nkkebG00xAMoZUUfOMcLd/0DVvhuv4sjhr9RIZB4vvs/WsDnd5 ZcVbVUxkbjWvQe6/KMyA5ISrkfX39JjDRWGX/A1wP9KH0vyes1tsP70PFD2T9VWFHxhL 8HJgYBLWiAX9cgfbZLmg/OOGI5G8o4G3Irdpv3EjZe/lnh6D8zLmW+DwfYwT25K4vdij xBL9uJWhDptZmwN53rFCIFJNvdo0Kjw7RlgrOGFdGJbAUTUofixJEjH1SHK20joobuM8 BKHNa4j2hr05ZMW1gwhDTKYCN9u2ZrR5DuW+6oqfMuXMq8VwTinyrRquG3O8/1H0OqZk KD2w== X-Gm-Message-State: AOAM531FiN1d3AUNKF6XUtj9OyQy/pstCm8BLTvwYYA5DDKkrad/de/r LUZo0h2CPi8rlgKV9eFX+T1WEiqN X-Google-Smtp-Source: ABdhPJxVRQSxOVe/2e9Ph5nzkeeO5xcy1nbYxdf35mJm41j0UOFiUOzNVz5K4WJ/FtwIgoSYLxNmiA== X-Received: by 2002:a17:90a:eb0d:: with SMTP id j13mr10470703pjz.163.1629916263928; Wed, 25 Aug 2021 11:31:03 -0700 (PDT) Return-Path: Received: from localhost.localdomain ([2601:1c2:680:1319:692:26ff:feda:3a81]) by smtp.gmail.com with ESMTPSA id x20sm382813pfh.188.2021.08.25.11.31.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Aug 2021 11:31:03 -0700 (PDT) From: John Stultz To: lkml Cc: John Stultz , Daniel Vetter , Christian Koenig , Sumit Semwal , Liam Mark , Chris Goldsworthy , Laura Abbott , Brian Starkey , Hridya Valsaraju , Suren Baghdasaryan , Sandeep Patil , Daniel Mentz , =?utf-8?q?=C3=98rjan_Eide?= , Robin Murphy , Ezequiel Garcia , Simon Ser , James Jones , Leo Yan , linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org Subject: [RFC][PATCH] dma-buf: system_heap: Avoid warning on mid-order allocations Date: Wed, 25 Aug 2021 18:30:59 +0000 Message-Id: <20210825183059.1085561-1-john.stultz@linaro.org> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 When trying to do mid-order allocations, set __GFP_NOWARN to avoid warning messages if the allocation fails, as we will still fall back to single page allocatitions in that case. This is the similar to what we already do for large order allocations. Cc: Daniel Vetter Cc: Christian Koenig Cc: Sumit Semwal Cc: Liam Mark Cc: Chris Goldsworthy Cc: Laura Abbott Cc: Brian Starkey Cc: Hridya Valsaraju Cc: Suren Baghdasaryan Cc: Sandeep Patil Cc: Daniel Mentz Cc: Ørjan Eide Cc: Robin Murphy Cc: Ezequiel Garcia Cc: Simon Ser Cc: James Jones Cc: Leo Yan Cc: linux-media@vger.kernel.org Cc: dri-devel@lists.freedesktop.org Signed-off-by: John Stultz --- drivers/dma-buf/heaps/system_heap.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) -- 2.25.1 diff --git a/drivers/dma-buf/heaps/system_heap.c b/drivers/dma-buf/heaps/system_heap.c index 23a7e74ef966..f57a39ddd063 100644 --- a/drivers/dma-buf/heaps/system_heap.c +++ b/drivers/dma-buf/heaps/system_heap.c @@ -40,11 +40,12 @@ struct dma_heap_attachment { bool mapped; }; +#define LOW_ORDER_GFP (GFP_HIGHUSER | __GFP_ZERO | __GFP_COMP) +#define MID_ORDER_GFP (LOW_ORDER_GFP | __GFP_NOWARN) #define HIGH_ORDER_GFP (((GFP_HIGHUSER | __GFP_ZERO | __GFP_NOWARN \ | __GFP_NORETRY) & ~__GFP_RECLAIM) \ | __GFP_COMP) -#define LOW_ORDER_GFP (GFP_HIGHUSER | __GFP_ZERO | __GFP_COMP) -static gfp_t order_flags[] = {HIGH_ORDER_GFP, LOW_ORDER_GFP, LOW_ORDER_GFP}; +static gfp_t order_flags[] = {HIGH_ORDER_GFP, MID_ORDER_GFP, LOW_ORDER_GFP}; /* * The selection of the orders used for allocation (1MB, 64K, 4K) is designed * to match with the sizes often found in IOMMUs. Using order 4 pages instead