[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Y8/r91PGGiY5JJvE@nvidia.com>
Date: Tue, 24 Jan 2023 10:32:23 -0400
From: Jason Gunthorpe <jgg@...dia.com>
To: Alistair Popple <apopple@...dia.com>
Cc: 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, 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 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_USER: Accounnt locked memory to user->locked_vm.
> + *
> + * Determines which statistic pinned/locked memory is accounted
> + * against. All limits will be enforced against RLIMIT_MEMLOCK and the
> + * pins cgroup if CONFIG_CGROUP_PINS is enabled.
> + *
> + * New drivers should use VM_ACCOUNT_TASK. VM_ACCOUNT_USER is used by
> + * pre-existing drivers to maintain existing accounting against
> + * user->locked_mm rather than mm->pinned_mm.
I thought the guidance was the opposite of this, it is the newer
places in the kernel that are using VM_ACCOUNT_USER?
I haven't got to the rest of the patches yet, but isn't there also a
mm->pinned_vm vs mm->locked_vm variation in the current drivers as
well?
> +void vm_account_init_current(struct vm_account *vm_account)
> +{
> + vm_account_init(vm_account, current, NULL, VM_ACCOUNT_TASK);
> +}
> +EXPORT_SYMBOL_GPL(vm_account_init_current);
This can probably just be a static inline
You might consider putting all this in some new vm_account.h - given
how rarely it is used? Compile times and all
Jason
Powered by blists - more mailing lists