Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp602820pxb; Wed, 27 Jan 2021 16:25:42 -0800 (PST) X-Google-Smtp-Source: ABdhPJwtcnRnHBwcjbHNd+b3gWG1Y5kiglxWxGuh2U44P+BiXa54IAEvLMNbR2cof+bdsne9Oa1r X-Received: by 2002:a17:906:3e96:: with SMTP id a22mr6901073ejj.144.1611793542528; Wed, 27 Jan 2021 16:25:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611793542; cv=none; d=google.com; s=arc-20160816; b=ORW8vzK+Abf5MgcvgAAqobowSzgIBvSPmeJBJtoCBv9JoIc4ZVhWXWGrx7mhac0P5T D73ifIzDuHjKQK3DEKWAsHJwDfevvNlTM0tAI91m4ef2nry1w+cFilt6QVKrUZ2UXmzA hg2M44GbTK44AzR1E9kAEWh5P4nKJihKJMKhDcLORUGPKW8bH776KbmUPFmt3aNWDvf5 QW/WK9j/SYEIkXaIi9CXg3rfgRhFObrNJpARJ2Wg0Hh5/V/dTbSyIx15wWCKe4q/KoYs VfNlWDCxMxEWy+zLXQCg2vkBrOmeYtTNNppQfumTVxURspkLsXrvOrSqBMYsbBVxo+tB 7cjg== 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=JkWQEhwAUNLuJiPKeTazkmms8jXTo1ixUZEQclL+Lbo=; b=ICxzOcOEyn8OCwir4Mhjp38Jk/i+Ox50badk1ggg4XzrF9Yvfs/G6frGqyHoIg+IAM PoswWEnUCf3aXS+IxLsFn4ykW74HciSViGW8MnVTf2A3cru1IwsgeeFVZ900U12iOOVb 4Hj4NqBOKSXYHwGNL7rvSTKA/nRQ0uWXH9Bw4Ev+qDEs9VMugTEmbw9h8kXkXPubxSTb WqP0hGcYhxKHxxsxj9sd9A0+X/Sen74hHhKhv2irdJVT6yyKUeLnUHcVaYfdsZ4TR6et q3m4kGFXQE7CdxpEyv+JtX2s0sWexjijf0umaPh/RHT2/YJryr0Ko1QV4V89tkDpEqEK lrrQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=r9q6TDXO; 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 e6si1974494edz.361.2021.01.27.16.25.18; Wed, 27 Jan 2021 16:25:42 -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=r9q6TDXO; 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 S232216AbhA0UWM (ORCPT + 99 others); Wed, 27 Jan 2021 15:22:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35802 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232039AbhA0UWI (ORCPT ); Wed, 27 Jan 2021 15:22:08 -0500 Received: from mail-ua1-x92b.google.com (mail-ua1-x92b.google.com [IPv6:2607:f8b0:4864:20::92b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EF660C061574 for ; Wed, 27 Jan 2021 12:21:27 -0800 (PST) Received: by mail-ua1-x92b.google.com with SMTP id k22so1212072ual.0 for ; Wed, 27 Jan 2021 12:21:27 -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=JkWQEhwAUNLuJiPKeTazkmms8jXTo1ixUZEQclL+Lbo=; b=r9q6TDXOq/oTKZfsDu88FKmFK1jFkobThy3I5RX5yDOWeZCqbXkAPofOZhwyzoX0S4 lmw2aOQ11GEmGdt9SOTMz11LnKqrdTCNN4gnubxwe3dHZMhv+VsV8YZVjYxDcM5GYvec yEt+m/lAgrwWi3TGc166UztCAqnGYfmm3+WjObS9ymcp0mxV2NdAFelIasNCR9kP04OH EwBxAVdECFQaUOAnYMyIv8j85clAcXLfBlFscijmq8Zod7kAQCoW/+/203JvholLWk+4 l4wJqVoFVxOmT+KnOdgd6PKD/9pTOcZiIb4GqWwjjWcspeNyAIXi9wFcN6CZ161qe0cV R4iQ== 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=JkWQEhwAUNLuJiPKeTazkmms8jXTo1ixUZEQclL+Lbo=; b=LzDrjPu+O935rz5dJEFnyrX/cDq+haX7L8wO531ZKhqBb1Y5mSLneuOjq+yWm4TkrJ UfpNH53zFZLxDgvNj/Plvu2zPzLITFhJ4Rpe2nfImNCJGO3nCY5s8B16FEAJIqi7uo+Q 6VEBl5yW/8AJJ2Kil9z1ZAEkZ3UsUNicuRJQ2Hts8u7tzidkDl9znJ573PsUFTqyf1Zm 0UFL2p9kdFkYlrgqvASFgzRAKn4ZIH+WueTVwGeXqf0vQBewoc2dbIisbQhez0+LEtNh 64ic95hiZHmLNWvICxxq8QiZpG0Agno6+c979i4k612sdvIL5xiYPfTy6b0JCdAPTxAW UHZQ== X-Gm-Message-State: AOAM530hEIDPj+gzo75fLfZeyPmWg9UzACtAVZ7IqUssEwvABecqCn23 nwEyVmOYecKkrCevD4tkVEn5y+VJzqfL8VWP9I4VNeIQCxrpuw== X-Received: by 2002:ab0:7584:: with SMTP id q4mr9773201uap.35.1611778886742; Wed, 27 Jan 2021 12:21:26 -0800 (PST) MIME-Version: 1.0 References: <20210123034655.102813-1-john.stultz@linaro.org> <20210123034655.102813-2-john.stultz@linaro.org> In-Reply-To: <20210123034655.102813-2-john.stultz@linaro.org> From: Daniel Mentz Date: Wed, 27 Jan 2021 12:21:15 -0800 Message-ID: Subject: Re: [PATCH v2 2/3] dma-buf: system_heap: Add pagepool support to system heap To: John Stultz Cc: lkml , Daniel Vetter , Sumit Semwal , Liam Mark , Chris Goldsworthy , Laura Abbott , Brian Starkey , Hridya Valsaraju , Suren Baghdasaryan , Sandeep Patil , =?UTF-8?Q?=C3=98rjan_Eide?= , Robin Murphy , Ezequiel Garcia , Simon Ser , James Jones , linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jan 22, 2021 at 7:47 PM John Stultz wrote: > +static int system_heap_clear_pages(struct page **pages, int num, pgprot_t pgprot) > +{ > + void *addr = vmap(pages, num, VM_MAP, pgprot); > + > + if (!addr) > + return -ENOMEM; > + memset(addr, 0, PAGE_SIZE * num); > + vunmap(addr); > + return 0; > +} I thought that vmap/vunmap are expensive, and I am wondering if there's a faster way that avoids vmap. How about lifting this code from lib/iov_iter.c static void memzero_page(struct page *page, size_t offset, size_t len) { char *addr = kmap_atomic(page); memset(addr + offset, 0, len); kunmap_atomic(addr); } Or what about lifting that code from the old ion_cma_heap.c if (PageHighMem(pages)) { unsigned long nr_clear_pages = nr_pages; struct page *page = pages; while (nr_clear_pages > 0) { void *vaddr = kmap_atomic(page); memset(vaddr, 0, PAGE_SIZE); kunmap_atomic(vaddr); page++; nr_clear_pages--; } } else { memset(page_address(pages), 0, size); }