From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D2830C433DB for ; Thu, 4 Feb 2021 15:33:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A1B1564F45 for ; Thu, 4 Feb 2021 15:33:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237203AbhBDPc6 (ORCPT ); Thu, 4 Feb 2021 10:32:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37540 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237303AbhBDPXo (ORCPT ); Thu, 4 Feb 2021 10:23:44 -0500 Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 784B3C0613D6 for ; Thu, 4 Feb 2021 07:23:04 -0800 (PST) Received: by mail-wm1-x32d.google.com with SMTP id o10so6143300wmc.1 for ; Thu, 04 Feb 2021 07:23:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=date:from:to:cc:subject:message-id:mail-followup-to:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=FOhHJFN1Uk3imxDHDCmlGLnl9VnriOFj98ccGjxS3EU=; b=F1sXbq67W/pxmK1zXgV072u16BTrlrCAVP0it0HAR2Fp+Zt8xtCTCV7y3dnPlv8saB C+cdlziGxcEaC41JXpDQHnBBFrlli0RiOpXwtfNzva6k49/rHVQWlo7T6bMUHbsWzn6Y S/kZWGhIJchjl7dG5v++X+mpllv4Fcml2LDrc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id :mail-followup-to:references:mime-version:content-disposition :content-transfer-encoding:in-reply-to; bh=FOhHJFN1Uk3imxDHDCmlGLnl9VnriOFj98ccGjxS3EU=; b=mML0K3qaDXaD1yRr5j6aDa/wQFemb42POWfQ2hiWFzDKkKzW832zcmfrUT2vCnM6vX ngj0NAFZNHB71m+jVFUhs4T6FZU87cNCbZEOOSzB17tZTJIoxsdTWuUFT7XBZTvlzeAU /CCyY+yuje/NwlVV4ZWQx2u2kXdaqATATuk1fBqkb8zRpBjI8bBgKNWOoDoRsBskwx8+ 10rIaNiUtkXmh9M5nw6/fGKItIxCpa7ZSWw/eMM0ERTDkLT6Sc7ZY3QPKb8Wkao/9o2P qqnYrOPsSDJD9LQ1D4gXplFiRbO9Pfao1nvcQbha+nJAm5xqF64lN+CLAzY4QcgMCaKl uW7Q== X-Gm-Message-State: AOAM533lOfnOPT8M9dCH6joN1L53pLNWsL6ZvFqe6RlJuTQYk4fooTpj v6KGR5DTWjfh6Xijs1Q8RRngHw== X-Google-Smtp-Source: ABdhPJzWUE8+keCZMjDw4Qd96B14poTeso3FJmwHG+VBS+pVfTYio5MuASNi3L9GB8fNZbR908SB5g== X-Received: by 2002:a7b:c5c1:: with SMTP id n1mr6103154wmk.163.1612452183199; Thu, 04 Feb 2021 07:23:03 -0800 (PST) Received: from phenom.ffwll.local ([2a02:168:57f4:0:efd0:b9e5:5ae6:c2fa]) by smtp.gmail.com with ESMTPSA id v6sm8776760wrx.32.2021.02.04.07.23.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Feb 2021 07:23:02 -0800 (PST) Date: Thu, 4 Feb 2021 16:22:59 +0100 From: Daniel Vetter To: Christian =?iso-8859-1?Q?K=F6nig?= Cc: Suren Baghdasaryan , Daniel Vetter , Matthew Wilcox , "moderated list:DMA BUFFER SHARING FRAMEWORK" , Sandeep Patil , Android Kernel Team , James Jones , Linux Kernel Mailing List , Liam Mark , Brian Starkey , Christoph Hellwig , Minchan Kim , Linux MM , John Stultz , dri-devel , Chris Goldsworthy , Hridya Valsaraju , Andrew Morton , Robin Murphy , "open list:DMA BUFFER SHARING FRAMEWORK" Subject: Re: [Linaro-mm-sig] [PATCH 1/2] mm: replace BUG_ON in vm_insert_page with a return of an error Message-ID: Mail-Followup-To: Christian =?iso-8859-1?Q?K=F6nig?= , Suren Baghdasaryan , Matthew Wilcox , "moderated list:DMA BUFFER SHARING FRAMEWORK" , Sandeep Patil , Android Kernel Team , James Jones , Linux Kernel Mailing List , Liam Mark , Brian Starkey , Christoph Hellwig , Minchan Kim , Linux MM , John Stultz , dri-devel , Chris Goldsworthy , Hridya Valsaraju , Andrew Morton , Robin Murphy , "open list:DMA BUFFER SHARING FRAMEWORK" References: <20210203003134.2422308-1-surenb@google.com> <20210203015553.GX308988@casper.infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Operating-System: Linux phenom 5.7.0-1-amd64 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Feb 04, 2021 at 09:16:32AM +0100, Christian König wrote: > Am 03.02.21 um 22:41 schrieb Suren Baghdasaryan: > > [SNIP] > > > > How many semi-unrelated buffer accounting schemes does google come up with? > > > > > > > > We're at three with this one. > > > > > > > > And also we _cannot_ required that all dma-bufs are backed by struct > > > > page, so requiring struct page to make this work is a no-go. > > > > > > > > Second, we do not want to all get_user_pages and friends to work on > > > > dma-buf, it causes all kinds of pain. Yes on SoC where dma-buf are > > > > exclusively in system memory you can maybe get away with this, but > > > > dma-buf is supposed to work in more places than just Android SoCs. > > > I just realized that vm_inser_page doesn't even work for CMA, it would > > > upset get_user_pages pretty badly - you're trying to pin a page in > > > ZONE_MOVEABLE but you can't move it because it's rather special. > > > VM_SPECIAL is exactly meant to catch this stuff. > > Thanks for the input, Daniel! Let me think about the cases you pointed out. > > > > IMHO, the issue with PSS is the difficulty of calculating this metric > > without struct page usage. I don't think that problem becomes easier > > if we use cgroups or any other API. I wanted to enable existing PSS > > calculation mechanisms for the dmabufs known to be backed by struct > > pages (since we know how the heap allocated that memory), but sounds > > like this would lead to problems that I did not consider. > > Yeah, using struct page indeed won't work. We discussed that multiple times > now and Daniel even has a patch to mangle the struct page pointers inside > the sg_table object to prevent abuse in that direction. > > On the other hand I totally agree that we need to do something on this side > which goes beyong what cgroups provide. > > A few years ago I came up with patches to improve the OOM killer to include > resources bound to the processes through file descriptors. I unfortunately > can't find them of hand any more and I'm currently to busy to dig them up. > > In general I think we need to make it possible that both the in kernel OOM > killer as well as userspace processes and handlers have access to that kind > of data. > > The fdinfo approach as suggested in the other thread sounds like the easiest > solution to me. Yeah for OOM handling cgroups alone isn't enough as the interface - we need to make sure that oom killer takes into account the system memory usage (ideally zone aware, for CMA pools). But to track that we still need that infrastructure first I think. -Daniel -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8EC05C433DB for ; Thu, 4 Feb 2021 15:23:07 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id F3D5164DDA for ; Thu, 4 Feb 2021 15:23:06 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F3D5164DDA Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ffwll.ch Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 49E976B0005; Thu, 4 Feb 2021 10:23:06 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 4282C6B0006; Thu, 4 Feb 2021 10:23:06 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2F1BA6B006C; Thu, 4 Feb 2021 10:23:06 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0039.hostedemail.com [216.40.44.39]) by kanga.kvack.org (Postfix) with ESMTP id 127836B0005 for ; Thu, 4 Feb 2021 10:23:06 -0500 (EST) Received: from smtpin21.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id BDB91180AD81A for ; Thu, 4 Feb 2021 15:23:05 +0000 (UTC) X-FDA: 77780953530.21.sense63_5f0e36c275dd Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin21.hostedemail.com (Postfix) with ESMTP id 81BCB180442C4 for ; Thu, 4 Feb 2021 15:23:05 +0000 (UTC) X-HE-Tag: sense63_5f0e36c275dd X-Filterd-Recvd-Size: 7905 Received: from mail-wm1-f54.google.com (mail-wm1-f54.google.com [209.85.128.54]) by imf45.hostedemail.com (Postfix) with ESMTP for ; Thu, 4 Feb 2021 15:23:04 +0000 (UTC) Received: by mail-wm1-f54.google.com with SMTP id t142so1301539wmt.1 for ; Thu, 04 Feb 2021 07:23:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=date:from:to:cc:subject:message-id:mail-followup-to:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=FOhHJFN1Uk3imxDHDCmlGLnl9VnriOFj98ccGjxS3EU=; b=F1sXbq67W/pxmK1zXgV072u16BTrlrCAVP0it0HAR2Fp+Zt8xtCTCV7y3dnPlv8saB C+cdlziGxcEaC41JXpDQHnBBFrlli0RiOpXwtfNzva6k49/rHVQWlo7T6bMUHbsWzn6Y S/kZWGhIJchjl7dG5v++X+mpllv4Fcml2LDrc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id :mail-followup-to:references:mime-version:content-disposition :content-transfer-encoding:in-reply-to; bh=FOhHJFN1Uk3imxDHDCmlGLnl9VnriOFj98ccGjxS3EU=; b=SkF9hweSZy3iudZ/Aysz3gGHRJr6tIMC238JOaxWPfjJ4ONQp52KttZQpWa6NtKEbr DzBoqRq0/WTaCeX4XPffG6QLFIjzYicFy9lslpwe1JuTwEMjsiR8jBnT4+sDrCKUBpDf DSlNPqlueO1Y8R5IyGH8lufkjrhIdPqYs/JXDWWfVDHpj3dpccrDkHGTDqPjLZpBF/bF kCXiE/VJFyS+es3zvejOARV+/otbhzOo/Bvd320x4hquKGoHk67Yhp3PPVOslKRo8Cdi rOFSHAF5A3XkbEe6NvHNU23JKFg4/55Pa+PnDisHCy9Aa1n4oXmg0CwJ6M+S2kqJUWle 4qcg== X-Gm-Message-State: AOAM533iiFEnZjaDxYLOBwzoxBb9VgXnzHRNzCcw6a0cK/5UiOVMkh8q PEdgRZ7u6ueF7zLp//vM1nP81Q== X-Google-Smtp-Source: ABdhPJzWUE8+keCZMjDw4Qd96B14poTeso3FJmwHG+VBS+pVfTYio5MuASNi3L9GB8fNZbR908SB5g== X-Received: by 2002:a7b:c5c1:: with SMTP id n1mr6103154wmk.163.1612452183199; Thu, 04 Feb 2021 07:23:03 -0800 (PST) Received: from phenom.ffwll.local ([2a02:168:57f4:0:efd0:b9e5:5ae6:c2fa]) by smtp.gmail.com with ESMTPSA id v6sm8776760wrx.32.2021.02.04.07.23.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Feb 2021 07:23:02 -0800 (PST) Date: Thu, 4 Feb 2021 16:22:59 +0100 From: Daniel Vetter To: Christian =?iso-8859-1?Q?K=F6nig?= Cc: Suren Baghdasaryan , Daniel Vetter , Matthew Wilcox , "moderated list:DMA BUFFER SHARING FRAMEWORK" , Sandeep Patil , Android Kernel Team , James Jones , Linux Kernel Mailing List , Liam Mark , Brian Starkey , Christoph Hellwig , Minchan Kim , Linux MM , John Stultz , dri-devel , Chris Goldsworthy , Hridya Valsaraju , Andrew Morton , Robin Murphy , "open list:DMA BUFFER SHARING FRAMEWORK" Subject: Re: [Linaro-mm-sig] [PATCH 1/2] mm: replace BUG_ON in vm_insert_page with a return of an error Message-ID: Mail-Followup-To: Christian =?iso-8859-1?Q?K=F6nig?= , Suren Baghdasaryan , Matthew Wilcox , "moderated list:DMA BUFFER SHARING FRAMEWORK" , Sandeep Patil , Android Kernel Team , James Jones , Linux Kernel Mailing List , Liam Mark , Brian Starkey , Christoph Hellwig , Minchan Kim , Linux MM , John Stultz , dri-devel , Chris Goldsworthy , Hridya Valsaraju , Andrew Morton , Robin Murphy , "open list:DMA BUFFER SHARING FRAMEWORK" References: <20210203003134.2422308-1-surenb@google.com> <20210203015553.GX308988@casper.infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: X-Operating-System: Linux phenom 5.7.0-1-amd64 Content-Transfer-Encoding: quoted-printable X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Thu, Feb 04, 2021 at 09:16:32AM +0100, Christian K=F6nig wrote: > Am 03.02.21 um 22:41 schrieb Suren Baghdasaryan: > > [SNIP] > > > > How many semi-unrelated buffer accounting schemes does google com= e up with? > > > >=20 > > > > We're at three with this one. > > > >=20 > > > > And also we _cannot_ required that all dma-bufs are backed by str= uct > > > > page, so requiring struct page to make this work is a no-go. > > > >=20 > > > > Second, we do not want to all get_user_pages and friends to work = on > > > > dma-buf, it causes all kinds of pain. Yes on SoC where dma-buf ar= e > > > > exclusively in system memory you can maybe get away with this, bu= t > > > > dma-buf is supposed to work in more places than just Android SoCs= . > > > I just realized that vm_inser_page doesn't even work for CMA, it wo= uld > > > upset get_user_pages pretty badly - you're trying to pin a page in > > > ZONE_MOVEABLE but you can't move it because it's rather special. > > > VM_SPECIAL is exactly meant to catch this stuff. > > Thanks for the input, Daniel! Let me think about the cases you pointe= d out. > >=20 > > IMHO, the issue with PSS is the difficulty of calculating this metric > > without struct page usage. I don't think that problem becomes easier > > if we use cgroups or any other API. I wanted to enable existing PSS > > calculation mechanisms for the dmabufs known to be backed by struct > > pages (since we know how the heap allocated that memory), but sounds > > like this would lead to problems that I did not consider. >=20 > Yeah, using struct page indeed won't work. We discussed that multiple t= imes > now and Daniel even has a patch to mangle the struct page pointers insi= de > the sg_table object to prevent abuse in that direction. >=20 > On the other hand I totally agree that we need to do something on this = side > which goes beyong what cgroups provide. >=20 > A few years ago I came up with patches to improve the OOM killer to inc= lude > resources bound to the processes through file descriptors. I unfortunat= ely > can't find them of hand any more and I'm currently to busy to dig them = up. >=20 > In general I think we need to make it possible that both the in kernel = OOM > killer as well as userspace processes and handlers have access to that = kind > of data. >=20 > The fdinfo approach as suggested in the other thread sounds like the ea= siest > solution to me. Yeah for OOM handling cgroups alone isn't enough as the interface - we need to make sure that oom killer takes into account the system memory usage (ideally zone aware, for CMA pools). But to track that we still need that infrastructure first I think. -Daniel --=20 Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4BC4BC433E0 for ; Thu, 4 Feb 2021 15:23:07 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id EC3CF64E31 for ; Thu, 4 Feb 2021 15:23:06 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EC3CF64E31 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ffwll.ch Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 449646ED8F; Thu, 4 Feb 2021 15:23:06 +0000 (UTC) Received: from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com [IPv6:2a00:1450:4864:20::32c]) by gabe.freedesktop.org (Postfix) with ESMTPS id 96B8B6ED8F for ; Thu, 4 Feb 2021 15:23:04 +0000 (UTC) Received: by mail-wm1-x32c.google.com with SMTP id a16so6153573wmm.0 for ; Thu, 04 Feb 2021 07:23:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=date:from:to:cc:subject:message-id:mail-followup-to:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=FOhHJFN1Uk3imxDHDCmlGLnl9VnriOFj98ccGjxS3EU=; b=F1sXbq67W/pxmK1zXgV072u16BTrlrCAVP0it0HAR2Fp+Zt8xtCTCV7y3dnPlv8saB C+cdlziGxcEaC41JXpDQHnBBFrlli0RiOpXwtfNzva6k49/rHVQWlo7T6bMUHbsWzn6Y S/kZWGhIJchjl7dG5v++X+mpllv4Fcml2LDrc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id :mail-followup-to:references:mime-version:content-disposition :content-transfer-encoding:in-reply-to; bh=FOhHJFN1Uk3imxDHDCmlGLnl9VnriOFj98ccGjxS3EU=; b=CrocRx2dgifXU7D1wX2uZVSyFB4l2mg/mSbkbYXD9VB46WIOTCIppnMF5iLnMUCZHv OWAH07aca/8I4EF1bJioExZSCnSRe2HRiDXOA2HMPc6ER72xMEK8qv/PUMlzHsJ51nq/ Qx7MhM3pqrJxjtQ/WfE994QKXalG6iLMuk0R/hQoDEWXz4mlCHo0jhgV9eN2RzqwffEl BCUB4+jBQWzjRBGMHZOnOnatEJRYMRQYhIhw4NusgR9x6DArmpMByfEm3Vd9whz7+Y3+ nmi1AxLjxJ6KHM3QROMdHwXU6NePAP8SJ2vNPzEqp/5WBWdY4RTYD6foHBlypQlOxq/g T6Yg== X-Gm-Message-State: AOAM5335GMiAzUEUNmm06MpqbFt8VTy2jBW/wHO1zKv9XasvCoYV4zNe Wah4abq/rWHc/X7E+YrlXJ7bFA== X-Google-Smtp-Source: ABdhPJzWUE8+keCZMjDw4Qd96B14poTeso3FJmwHG+VBS+pVfTYio5MuASNi3L9GB8fNZbR908SB5g== X-Received: by 2002:a7b:c5c1:: with SMTP id n1mr6103154wmk.163.1612452183199; Thu, 04 Feb 2021 07:23:03 -0800 (PST) Received: from phenom.ffwll.local ([2a02:168:57f4:0:efd0:b9e5:5ae6:c2fa]) by smtp.gmail.com with ESMTPSA id v6sm8776760wrx.32.2021.02.04.07.23.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Feb 2021 07:23:02 -0800 (PST) Date: Thu, 4 Feb 2021 16:22:59 +0100 From: Daniel Vetter To: Christian =?iso-8859-1?Q?K=F6nig?= Subject: Re: [Linaro-mm-sig] [PATCH 1/2] mm: replace BUG_ON in vm_insert_page with a return of an error Message-ID: Mail-Followup-To: Christian =?iso-8859-1?Q?K=F6nig?= , Suren Baghdasaryan , Matthew Wilcox , "moderated list:DMA BUFFER SHARING FRAMEWORK" , Sandeep Patil , Android Kernel Team , James Jones , Linux Kernel Mailing List , Liam Mark , Brian Starkey , Christoph Hellwig , Minchan Kim , Linux MM , John Stultz , dri-devel , Chris Goldsworthy , Hridya Valsaraju , Andrew Morton , Robin Murphy , "open list:DMA BUFFER SHARING FRAMEWORK" References: <20210203003134.2422308-1-surenb@google.com> <20210203015553.GX308988@casper.infradead.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Operating-System: Linux phenom 5.7.0-1-amd64 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Christoph Hellwig , Android Kernel Team , Sandeep Patil , dri-devel , Linux MM , Daniel Vetter , James Jones , Linux Kernel Mailing List , Matthew Wilcox , "moderated list:DMA BUFFER SHARING FRAMEWORK" , Minchan Kim , Liam Mark , Chris Goldsworthy , Hridya Valsaraju , Andrew Morton , "open list:DMA BUFFER SHARING FRAMEWORK" , Suren Baghdasaryan , Robin Murphy Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" On Thu, Feb 04, 2021 at 09:16:32AM +0100, Christian K=F6nig wrote: > Am 03.02.21 um 22:41 schrieb Suren Baghdasaryan: > > [SNIP] > > > > How many semi-unrelated buffer accounting schemes does google come = up with? > > > > = > > > > We're at three with this one. > > > > = > > > > And also we _cannot_ required that all dma-bufs are backed by struct > > > > page, so requiring struct page to make this work is a no-go. > > > > = > > > > Second, we do not want to all get_user_pages and friends to work on > > > > dma-buf, it causes all kinds of pain. Yes on SoC where dma-buf are > > > > exclusively in system memory you can maybe get away with this, but > > > > dma-buf is supposed to work in more places than just Android SoCs. > > > I just realized that vm_inser_page doesn't even work for CMA, it would > > > upset get_user_pages pretty badly - you're trying to pin a page in > > > ZONE_MOVEABLE but you can't move it because it's rather special. > > > VM_SPECIAL is exactly meant to catch this stuff. > > Thanks for the input, Daniel! Let me think about the cases you pointed = out. > > = > > IMHO, the issue with PSS is the difficulty of calculating this metric > > without struct page usage. I don't think that problem becomes easier > > if we use cgroups or any other API. I wanted to enable existing PSS > > calculation mechanisms for the dmabufs known to be backed by struct > > pages (since we know how the heap allocated that memory), but sounds > > like this would lead to problems that I did not consider. > = > Yeah, using struct page indeed won't work. We discussed that multiple tim= es > now and Daniel even has a patch to mangle the struct page pointers inside > the sg_table object to prevent abuse in that direction. > = > On the other hand I totally agree that we need to do something on this si= de > which goes beyong what cgroups provide. > = > A few years ago I came up with patches to improve the OOM killer to inclu= de > resources bound to the processes through file descriptors. I unfortunately > can't find them of hand any more and I'm currently to busy to dig them up. > = > In general I think we need to make it possible that both the in kernel OOM > killer as well as userspace processes and handlers have access to that ki= nd > of data. > = > The fdinfo approach as suggested in the other thread sounds like the easi= est > solution to me. Yeah for OOM handling cgroups alone isn't enough as the interface - we need to make sure that oom killer takes into account the system memory usage (ideally zone aware, for CMA pools). But to track that we still need that infrastructure first I think. -Daniel -- = Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel