Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1214379pxb; Thu, 4 Feb 2021 07:37:34 -0800 (PST) X-Google-Smtp-Source: ABdhPJygYb2HCWAyud/eAcH7DuMXkWvrgGQqWJOEyevia12e3TB9zniNBm6wQZ1gKMNaukk4RNvT X-Received: by 2002:a17:906:eb88:: with SMTP id mh8mr8341075ejb.150.1612453054290; Thu, 04 Feb 2021 07:37:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612453054; cv=none; d=google.com; s=arc-20160816; b=eUJcLXOJhTorUfCIJ65t1JjSX35rs/evi1wsCZrAkOGdX3RIAHLWOa80NtL10UVlCi 49ZDBsOht5zggLwV8AdwZcVFhoqEER98ntCau9d88OrnhP8OZ7wyIrerT8gANh3A0vJt ftLU/vsNFI/8MtG3I+vg8/SBtZAfwPMNy8PSGVYQeOxXir4MVDAEh2zpZ07GRFVIyxrd FftgBtgN8TNyY4ukxHis97Mp7F5AjcVA4ZaN/mcCPbrZujiSvtouOuivth4X0gfr2WY/ 75IY2S0l+2iFYhlWyylUkwDbLBv/s/ZcYBXh5AMGjGgZlwEtzjJ+KqnzWcrUH6RpdwmO NJ3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:mail-followup-to :message-id:subject:cc:to:from:date:dkim-signature; bh=FOhHJFN1Uk3imxDHDCmlGLnl9VnriOFj98ccGjxS3EU=; b=cyc5SYCSRzYK9buuqkmaBRuezc7UFOxlxAyZeFfIiN9X/qPUngZpGIaWtjzP33gteL IhGTwUu+Waw8kDqLe6owivwkG9fBjEtXxUSIMpoSc+isBFgKCjL7+BMILVtZ+6biuclu B4n7dKLjbopzc/mQinlBe7acUqxpky5dZMW+/37+eqKJB/T3rdrHQYrcoM1o7bZCEkob nailtvMmL9j4Wr9DYy5w6qPMPyFatIDI25ArRahiaNWeFYNJLryGIrs/oWxJIW6lWruP 5UlrTO+qzFfQ1LfFIjjIwlvFd2OgVmyC+ODL251F+U4ZQaz1w8iiSjsmglHkQ7K6DPIh 990w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ffwll.ch header.s=google header.b=F1sXbq67; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id de26si3346324ejc.515.2021.02.04.07.37.07; Thu, 04 Feb 2021 07:37:34 -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=@ffwll.ch header.s=google header.b=F1sXbq67; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237067AbhBDPct (ORCPT + 99 others); Thu, 4 Feb 2021 10:32:49 -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-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