[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <658eda9c-d716-fcb7-ba0c-b36f646195f1@redhat.com>
Date: Tue, 31 Jan 2023 15:00:08 +0100
From: David Hildenbrand <david@...hat.com>
To: Alistair Popple <apopple@...dia.com>, linux-mm@...ck.org,
cgroups@...r.kernel.org
Cc: linux-kernel@...r.kernel.org, jgg@...dia.com, jhubbard@...dia.com,
tjmercier@...gle.com, hannes@...xchg.org, surenb@...gle.com,
mkoutny@...e.com, daniel@...ll.ch, linuxppc-dev@...ts.ozlabs.org,
linux-fpga@...r.kernel.org, linux-rdma@...r.kernel.org,
virtualization@...ts.linux-foundation.org, kvm@...r.kernel.org,
netdev@...r.kernel.org, io-uring@...r.kernel.org,
bpf@...r.kernel.org, rds-devel@....oracle.com,
linux-kselftest@...r.kernel.org
Subject: Re: [RFC PATCH 01/19] mm: Introduce vm_account
On 24.01.23 06:42, Alistair Popple wrote:
> Kernel drivers that pin pages should account these pages against
> either user->locked_vm or mm->pinned_vm and fail the pinning if
> RLIMIT_MEMLOCK is exceeded and CAP_IPC_LOCK isn't held.
>
> Currently drivers open-code this accounting and use various methods to
> update the atomic variables and check against the limits leading to
> various bugs and inconsistencies. To fix this introduce a standard
> interface for charging pinned and locked memory. As this involves
> taking references on kernel objects such as mm_struct or user_struct
> we introduce a new vm_account struct to hold these references. Several
> helper functions are then introduced to grab references and check
> limits.
>
> As the way these limits are charged and enforced is visible to
> userspace we need to be careful not to break existing applications by
> charging to different counters. As a result the vm_account functions
> support accounting to different counters as required.
>
> A future change will extend this to also account against a cgroup for
> pinned pages.
The term "vm_account" is misleading, no? VM_ACCOUNT is for accounting
towards the commit limit ....
--
Thanks,
David / dhildenb
Powered by blists - more mailing lists