[PATCH RFC v2] mm: Add f_ops->populate()
Andrew Morton
akpm at linux-foundation.org
Sun Mar 6 23:24:56 UTC 2022
On Sun, 6 Mar 2022 05:26:55 +0200 Jarkko Sakkinen <jarkko at kernel.org> wrote:
> Sometimes you might want to use MAP_POPULATE to ask a device driver to
> initialize the device memory in some specific manner. SGX driver can use
> this to request more memory by issuing ENCLS[EAUG] x86 opcode for each
> page in the address range.
Why is this useful? Please fully describe the benefit to kernel users.
Convince us that the benefit justifies the code churn, maintenance
cost and larger kernel footprint.
Do we know of any other drivers which might use this?
> Add f_ops->populate() with the same parameters as f_ops->mmap() and make
> it conditionally called inside call_mmap(). Update call sites
> accodingly.
spello
> -static inline int call_mmap(struct file *file, struct vm_area_struct *vma)
> +static inline int call_mmap(struct file *file, struct vm_area_struct *vma, bool do_populate)
> {
> - return file->f_op->mmap(file, vma);
> + int ret = file->f_op->mmap(file, vma);
> +
> + if (!ret && do_populate && file->f_op->populate)
> + ret = file->f_op->populate(file, vma);
> +
> + return ret;
> }
Should this still be inlined?
More information about the dri-devel
mailing list