Re: [PATCH 02/12] kernfs: drop shared NUMA mempolicy hooks

From: Matthew Wilcox
Date: Mon Sep 25 2023 - 18:11:18 EST


On Mon, Sep 25, 2023 at 01:22:27AM -0700, Hugh Dickins wrote:
> It seems strange that kernfs should be an outlier with a set_policy and
> get_policy in its kernfs_vm_ops. Ah, it dates back to v2.6.30's commit
> 095160aee954 ("sysfs: fix some bin_vm_ops errors"), when I had crashed
> on powerpc's pci_mmap_legacy_page_range() fallback to shmem_zero_setup().
>
> Well, that was commendably thorough, to give sysfs-bin a set_policy and
> get_policy, just to avoid the way it was coded resulting in EINVAL from
> mmap when CONFIG_NUMA; but somehow feels a bit over-the-top to me now.
>
> It's easier to say that nobody should expect to manage a shmem object's
> shared NUMA mempolicy via some kernfs backdoor to that object: delete
> that code (and there's no longer an EINVAL from mmap in the NUMA case).
>
> This then leaves set_policy/get_policy as implemented only by shmem -
> though importantly also by SysV SHM, which has to interface with shmem
> which implements them, and with SHM_HUGETLB which does not.
>
> Signed-off-by: Hugh Dickins <hughd@xxxxxxxxxx>

Reviewed-by: Matthew Wilcox (Oracle) <willy@xxxxxxxxxxxxx>