[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CA+wgaPNQYMd8dyCcmHfHbCXKEqpF8i8nJQvb0cD1HEPG5hDMoA@mail.gmail.com>
Date: Tue, 10 Aug 2021 10:48:26 -0700
From: Hridya Valsaraju <hridya@...gle.com>
To: Sumit Semwal <sumit.semwal@...aro.org>,
Hridya Valsaraju <hridya@...gle.com>,
John Stultz <john.stultz@...aro.org>,
Benjamin Gaignard <benjamin.gaignard@...aro.org>,
Liam Mark <lmark@...eaurora.org>,
Laura Abbott <labbott@...hat.com>,
Brian Starkey <Brian.Starkey@....com>,
Christian König <christian.koenig@....com>,
linux-media <linux-media@...r.kernel.org>,
dri-devel <dri-devel@...ts.freedesktop.org>,
"moderated list:DMA BUFFER SHARING FRAMEWORK"
<linaro-mm-sig@...ts.linaro.org>,
lkml <linux-kernel@...r.kernel.org>,
Android Kernel Team <kernel-team@...roid.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Subject: Re: [PATCH] dma-buf: heaps: Set allocation limit for system heap
On Tue, Aug 10, 2021 at 1:40 AM Daniel Vetter <daniel@...ll.ch> wrote:
>
> On Tue, Aug 10, 2021 at 01:54:41PM +0530, Sumit Semwal wrote:
> > Hi Hridya,
> >
> > Apologies for the delay in responding.
> >
> > On Wed, 4 Aug 2021 at 03:09, Hridya Valsaraju <hridya@...gle.com> wrote:
> >
> > > On Mon, Aug 2, 2021 at 7:18 PM John Stultz <john.stultz@...aro.org> wrote:
> > > >
> > > > On Thu, Jul 22, 2021 at 12:07 PM Hridya Valsaraju <hridya@...gle.com>
> > > wrote:
> > > > > This patch limits the size of total memory that can be requested in a
> > > > > single allocation from the system heap. This would prevent a
> > > > > buggy/malicious client from depleting system memory by requesting for
> > > an
> > > > > extremely large allocation which might destabilize the system.
> > > > >
> > > > > The limit is set to half the size of the device's total RAM which is
> > > the
> > > > > same as what was set by the deprecated ION system heap.
> > > > >
> > > > > Signed-off-by: Hridya Valsaraju <hridya@...gle.com>
> > > >
> > > > Seems sane to me, unless folks have better suggestions for allocation
> > > limits.
> > > >
> > > > Reviewed-by: John Stultz <john.stultz@...aro.org>
> > >
> > > Thank you for taking a look John!
> > >
> > Looks good to me; I will apply it to drm-misc today.
>
> Please don't, this doesn't really solve anything:
> - it's easy to bypass, just allocate more buffers to get over the limit
> - resource limit plan is cgroups, not hand-rolled limits in every
> allocator
> - the ttm "max half of system memory" is for pinned memory, to work around
> locking inversion issues between dma_resv_lock and core mm shrinkers. It
> does not actually impose an overall allocation limit, you can allocate
> ttm bo until your entire memory (and swap) are full. Christian König has
> merged a patch set to lift this by reworking the shrinker interaction,
> but it had to be reverted again because of some fallout I can't remember
> offhand. dma_resv_lock vs shrinkers is very tricky.
>
> So if you want resource limits then you really want cgroups here.
Thanks Daniel and Sumit, that makes sense. Once the GPU memory
accounting cgroups are ready, we should be able to set the limit using
the same.
Regards,
Hridya
>
> Cheers, Daniel
>
> >
> >
> > >
> > > Regards,
> > > Hridya
> > >
> > > >
> > > > thanks
> > > > -john
> > >
> > Best,
> > Sumit.
> >
> > --
> > Thanks and regards,
> >
> > Sumit Semwal (he / him)
> > Tech Lead - LCG, Vertical Technologies
> > Linaro.org │ Open source software for ARM SoCs
>
> --
> Daniel Vetter
> Software Engineer, Intel Corporation
> http://blog.ffwll.ch
Powered by blists - more mailing lists