Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp676870pxb; Tue, 9 Feb 2021 09:38:43 -0800 (PST) X-Google-Smtp-Source: ABdhPJxjaF4HpIUaCB1xUf+6clcH7r8ivU4oIhR6S+UHbOREJonvFZgzCzuri4xozKbw5qfX62IP X-Received: by 2002:a05:6402:12d6:: with SMTP id k22mr18929318edx.368.1612892323162; Tue, 09 Feb 2021 09:38:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612892323; cv=none; d=google.com; s=arc-20160816; b=rrFXHg7X8kCX/IHNu5TiGKYtNgKo2Oxzh1IygSUoE0XG03rYxd+A9TqJkXQATO7sn8 yKdWznCokSa6Pnj67Hup4v3bElBkfSOIMxVVqfxYLL1e0sbnU83s6lBpDJUxvvWJaCVL tmXNMJ56grhSJnQIZPQbReU8GW3zoAuSrpyXdrSkq45R2D2NhGQfHnMacmRhnSLz/lCT /uyeGPf05WuL8gbG0m0BwZoUv7+vx2R2Cff0BRtLUSFXpIGFIAFxaJKTsKxa46iGiDrH kJNXte1uP6azlwF7FzXeTDg4tiHMy8L/JwjgxSz7ydQ41BZF7o2VK5JWxukszG9rHvbn I9Tg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=7JkPvEjrFUyCkgVos6hGetPZONkwMar8Z/Kg7PYRhYM=; b=jb204gnT+CBpPr97jOpbEjZJslfgQEFGvrOSCY86MfQjsAvm3f3U3b2P7Ogm7txWIv 3C37PCWkLGx3E6gt8Q6wf2TZAHUYnHUqBuSNmfX0VVa0rv//9XdyHorLZ0ST4YUQn4pq 8NWf3vQdnJ1wCUdJIzDKVeCPGV9Icim7jvbKiyJBGfaiUnK58rirg44+4+WF8rvyOzkY pyK7bpMHTYdwuJxZkacVHtI575a8SzqLwma01HaMyYbfSuZ1a2jRR4qATq0ngw1gpYT/ LmmDpqmENXRlYM74pG+WqoLp3UqRWJVCwnv+qwSDEqAXFk1msQnRHHv25w2qbz476oKR Ndow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=upyLM52z; 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 dr8si11443870ejc.138.2021.02.09.09.38.18; Tue, 09 Feb 2021 09:38:43 -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=upyLM52z; 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 S233267AbhBIRgI (ORCPT + 99 others); Tue, 9 Feb 2021 12:36:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53244 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233125AbhBIRej (ORCPT ); Tue, 9 Feb 2021 12:34:39 -0500 Received: from mail-wr1-x42f.google.com (mail-wr1-x42f.google.com [IPv6:2a00:1450:4864:20::42f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2C865C0617A9 for ; Tue, 9 Feb 2021 09:33:28 -0800 (PST) Received: by mail-wr1-x42f.google.com with SMTP id v15so22963530wrx.4 for ; Tue, 09 Feb 2021 09:33:28 -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:content-transfer-encoding; bh=7JkPvEjrFUyCkgVos6hGetPZONkwMar8Z/Kg7PYRhYM=; b=upyLM52zFkyCnjZekJtVFisSt9rvMDn2DCkv9o/ozl6Syfy0R8POrLtaFtvHM4IuLW YR3AZehBmbIDTcrj4AOyggAtW7xGtgKG9FgBAll0SNnvhOf51tH3hZmhTjtW88pFcNKI SQnWSwloX7GlynYWOjWqRGCIvYfsUfegRsIGtpH2r2CPaPhIOyrkCaeBBzu7pB5qbnNZ sPtzYMXMTzBibIkvKwk8Yxp6mWXyVER8whJp7y3VTO7TwqZFy7UpCqxW7U5ZODAbBDhf BUYFOQUFamp9MuioB8GMfBbWejqqYQX1QbFUK6KfjUwdS1+DIGJRZMgHYhowuL2cBR9u nXog== 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:content-transfer-encoding; bh=7JkPvEjrFUyCkgVos6hGetPZONkwMar8Z/Kg7PYRhYM=; b=jBPzu+gF+lVbbiU/xxT9AHFiafDtYjaef9AOLCWxxeCuViH8epPn5CzHw71qKFY7uE rU+c9FPaMLnrngwlWcLYwSEMW0L6Apsl2+j8dMrxEeqpU1rv9N2XIxkkT1yw7oCbpEaN QsCpiWh1Eii8iFv1jsDN90VNxq5oG5div4StOngeX2tBTRFlM/omyZvpB9XeD4uaHsdz U8FbSHEmGrX+joPKNHA3/jW4C3Ydf9Y1cxEwkahXmiSwcHh0iAR5Q/HAvNMs47syZ2tP 8KksvrMNCHeeW3c4MNcTYLNlPEXgZvxJ1Q/534Ux8KcmZCiw8fu8oWKasj/FAAHYyoF/ M6vg== X-Gm-Message-State: AOAM533ZS+8W3FxH7CHI042NFNyC5NV1l3J2qPskv+jJl+psLDuHL1jG +ANV5Ab2qd2p/7/KBuJvowLaQFYc4O8nJ21unf0DeGQShRwUmA== X-Received: by 2002:adf:ed45:: with SMTP id u5mr26626811wro.358.1612892006726; Tue, 09 Feb 2021 09:33:26 -0800 (PST) MIME-Version: 1.0 References: <20210205080621.3102035-1-john.stultz@linaro.org> <20210205080621.3102035-2-john.stultz@linaro.org> <4471b3b0-603e-6dbb-8064-ff4a95afbba9@amd.com> <48225879-2fe1-22ac-daae-c61d52465aea@amd.com> In-Reply-To: From: Suren Baghdasaryan Date: Tue, 9 Feb 2021 09:33:15 -0800 Message-ID: Subject: Re: [RFC][PATCH v6 1/7] drm: Add a sharable drm page-pool implementation To: =?UTF-8?Q?Christian_K=C3=B6nig?= Cc: John Stultz , lkml , Daniel Vetter , Sumit Semwal , Liam Mark , Chris Goldsworthy , Laura Abbott , Brian Starkey , Hridya Valsaraju , Sandeep Patil , Daniel Mentz , =?UTF-8?Q?=C3=98rjan_Eide?= , Robin Murphy , Ezequiel Garcia , Simon Ser , James Jones , linux-media , dri-devel Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Feb 9, 2021 at 4:57 AM Christian K=C3=B6nig wrote: > > Am 09.02.21 um 13:11 schrieb Christian K=C3=B6nig: > > [SNIP] > >>>> +void drm_page_pool_add(struct drm_page_pool *pool, struct page *pag= e) > >>>> +{ > >>>> + spin_lock(&pool->lock); > >>>> + list_add_tail(&page->lru, &pool->items); > >>>> + pool->count++; > >>>> + atomic_long_add(1 << pool->order, &total_pages); > >>>> + spin_unlock(&pool->lock); > >>>> + > >>>> + mod_node_page_state(page_pgdat(page), > >>>> NR_KERNEL_MISC_RECLAIMABLE, > >>>> + 1 << pool->order); > >>> Hui what? What should that be good for? > >> This is a carryover from the ION page pool implementation: > >> https://nam11.safelinks.protection.outlook.com/?url=3Dhttps%3A%2F%2Fgi= t.kernel.org%2Fpub%2Fscm%2Flinux%2Fkernel%2Fgit%2Ftorvalds%2Flinux.git%2Ftr= ee%2Fdrivers%2Fstaging%2Fandroid%2Fion%2Fion_page_pool.c%3Fh%3Dv5.10%23n28&= amp;data=3D04%7C01%7Cchristian.koenig%40amd.com%7Cc4eadb0a9cf6491d99ba08d8c= a173457%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637481548325174885%7CU= nknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLC= JXVCI6Mn0%3D%7C1000&sdata=3DFUjZK5NSDMUYfU7vGeE4fDU2HCF%2FYyNBwc30aoLLP= Q4%3D&reserved=3D0 > >> > >> > >> My sense is it helps with the vmstat/meminfo accounting so folks can > >> see the cached pages are shrinkable/freeable. This maybe falls under > >> other dmabuf accounting/stats discussions, so I'm happy to remove it > >> for now, or let the drivers using the shared page pool logic handle > >> the accounting themselves? > > Intentionally separated the discussion for that here. > > As far as I can see this is just bluntly incorrect. > > Either the page is reclaimable or it is part of our pool and freeable > through the shrinker, but never ever both. IIRC the original motivation for counting ION pooled pages as reclaimable was to include them into /proc/meminfo's MemAvailable calculations. NR_KERNEL_MISC_RECLAIMABLE defined as "reclaimable non-slab kernel pages" seems like a good place to account for them but I might be wrong. > > In the best case this just messes up the accounting, in the worst case > it can cause memory corruption. > > Christian.