[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87edqt243d.fsf@nvidia.com>
Date: Mon, 13 Feb 2023 22:30:42 +1100
From: Alistair Popple <apopple@...dia.com>
To: Jens Axboe <axboe@...nel.dk>
Cc: Jason Gunthorpe <jgg@...dia.com>, linux-mm@...ck.org,
cgroups@...r.kernel.org, linux-kernel@...r.kernel.org,
jhubbard@...dia.com, tjmercier@...gle.com, hannes@...xchg.org,
surenb@...gle.com, mkoutny@...e.com, daniel@...ll.ch,
"Daniel P . Berrange" <berrange@...hat.com>,
Alex Williamson <alex.williamson@...hat.com>,
Pavel Begunkov <asml.silence@...il.com>,
io-uring@...r.kernel.org
Subject: Re: [PATCH 09/19] io_uring: convert to use vm_account
Jens Axboe <axboe@...nel.dk> writes:
> On 2/7/23 7:55?AM, Jason Gunthorpe wrote:
>> On Tue, Feb 07, 2023 at 07:28:56AM -0700, Jens Axboe wrote:
>>
>>> Outside of that, we're now doubling the amount of memory associated with
>>> tracking this. That isn't necessarily a showstopper, but it is not
>>> ideal. I didn't take a look at the other conversions (again, because
>>> they were not sent to me), but seems like the task_struct and flags
>>> could just be passed in as they may very well be known to many/most
>>> callers?
>>
>> For places doing the mm accounting type it cannot use the task struct
>> as the underlying mm can be replaced and keep the task, IIRC.
>>
>> We just had a bug in VFIO related to this..
>>
>> If we could go back from the mm to the task (even a from a destroyed
>> mm though) that might work to reduce storage?
Yes, it's the going back from a destroyed mm that gets a bit murky. I
don't think it's a showstopper as we could probably keep track of that
when we destroy the mm but it seems like a fair amount of complexity to
save a smallish amount of memory.
However if we end up tacking this onto memcg instead then we could use
that to go back to the task and move any charges when the mm moves.
> Then maybe just nest them:
>
> struct small_one {
> struct mm_struct *mm;
> struct user_struct *user;
> };
>
> struct big_one {
> struct small_one foo;
> struct task_struct *task;
> enum vm_account_flags flags;
> };
>
> and have the real helpers deal with small_one, and wrappers around that
> taking big_one that just passes in the missing bits. Then users that
> don't need the extra bits can just use the right API.
Thanks for the suggestion, it should work noting that we will have to
add a struct pins_cgroup pointer to struct small_one. It may also help
with a similar problem I was having with one of the networking
conversions.
Powered by blists - more mailing lists