[PATCH 01/19] mm: Introduce vm_account

2023-02-05 Thread Alistair Popple
Kernel drivers that pin pages should account these pages against either user->locked_vm and/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

Re: [RFC PATCH 01/19] mm: Introduce vm_account

2023-01-31 Thread David Hildenbrand
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 t

Re: [RFC PATCH 01/19] mm: Introduce vm_account

2023-01-30 Thread Alistair Popple
Jason Gunthorpe writes: > On Tue, Jan 24, 2023 at 04:42:30PM +1100, Alistair Popple wrote: >> +/** >> + * enum vm_account_flags - Determine how pinned/locked memory is accounted. >> + * @VM_ACCOUNT_TASK: Account pinned memory to mm->pinned_vm. >> + * @VM_ACCOUNT_BYPASS: Don't enforce rlimit on

Re: [RFC PATCH 01/19] mm: Introduce vm_account

2023-01-24 Thread Jason Gunthorpe
On Tue, Jan 24, 2023 at 04:42:30PM +1100, Alistair Popple wrote: > +/** > + * enum vm_account_flags - Determine how pinned/locked memory is accounted. > + * @VM_ACCOUNT_TASK: Account pinned memory to mm->pinned_vm. > + * @VM_ACCOUNT_BYPASS: Don't enforce rlimit on any charges. > + * @VM_ACCOUNT_USE

Re: [RFC PATCH 01/19] mm: Introduce vm_account

2023-01-23 Thread Christoph Hellwig
> +/** > + * vm_account_init - Initialise a new struct vm_account. > + * @vm_account: pointer to uninitialised vm_account. > + * @task: task to charge against. > + * @user: user to charge against. Must be non-NULL for VM_ACCOUNT_USER. > + * @flags: flags to use when charging to vm_account. > + * >

[RFC PATCH 01/19] mm: Introduce vm_account

2023-01-23 Thread Alistair Popple
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 agai