Re: [PATCH 0/3] mm/arch: Fix a few collide definition on private use of VM_FAULT_*

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Feb 06, 2023 at 12:10:53AM +0000, Matthew Wilcox wrote:
> On Sun, Feb 05, 2023 at 06:17:01PM -0500, Peter Xu wrote:
> > I noticed a few collision usage on VM_FAULT_* definition in the page fault
> > path on arm/arm64/s390 where the VM_FAULT_* can overlap with the generic
> > definition of vm_fault_reason.
> > 
> > The major overlapped part being VM_FAULT_HINDEX_MASK which is used only by
> > the hugetlb hwpoisoning.
> > 
> > I'm not sure whether any of them can have a real impact, but that does not
> > look like to be expected.  I didn't copy stable, if anyone thinks it should
> > please shoot.  Nor did I test them in any form - I just changed the
> > allocations from top bits and added a comment for each of them.
> 
> This seems like a bad way to do it.  Why not just put these VM_FAULT_*
> definitions in linux/mm_types.h?  Then we'll see them when adding new
> VM_FAULT codes.  Sure, they won't be used by every architecture, but
> so what?

My initial version actually contains a few VM_FAULT_PRIVATE_N there, but I
noticed only the minority uses that, especially there's s390 which takes 5
entries.  I didn't had my mind straight on which's the best to go, then I
removed them and posted this simpler version, with comment on each to fix
the issues, more in a sense of raising the problem first.

I agree it isn't a problem at all, not until 32 bits all used up.  But that
seems to slightly encourage more archs from using the new private entries
which I wanted to avoid.

If to take a closer look, we may not really need that much private entries.
With s390, what I read is:

  - VM_FAULT_BADMAP could be replaced directly with VM_FAULT_SIGSEGV?
  - VM_FAULT_PFAULT could be replaced directly with VM_FAULT_BADCONTEXT?

Then if I'm not wrong we can already reduce 5->3 private entries.

I didn't directly change that because I am not 100% confident and I can't
test them myself.  It'll be great if arch people can have a look at either
s390 and arm to see whether there's chance of simplifcations first.  So the
patchset is more of raising the collision issue first, meanwhile great to
attract attention for arch people to refactor upon it.

I can also try to reduce the private entries and introduce PRIVATE entries
accordingly as you suggested, but I'll need more help on reviews and tests
than this one.

Thanks,

-- 
Peter Xu





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux