Messages in this thread | | | Date | Wed, 22 Jan 2014 14:02:14 -0600 | From | Alex Thorlton <> | Subject | Re: [PATCH 0/2] mm->def_flags cleanups (Was: Change khugepaged to respect MMF_THP_DISABLE flag) |
| |
On Wed, Jan 22, 2014 at 08:43:27PM +0100, Oleg Nesterov wrote: > On 01/22, Oleg Nesterov wrote: > > > > On 01/22, Alex Thorlton wrote: > > > > + case PR_SET_THP_DISABLE: > > > > + case PR_GET_THP_DISABLE: > > > > + down_write(&me->mm->mmap_sem); > > > > + if (option == PR_SET_THP_DISABLE) { > > > > + if (arg2) > > > > + me->mm->def_flags |= VM_NOHUGEPAGE; > > > > + else > > > > + me->mm->def_flags &= ~VM_NOHUGEPAGE; > > > > + } else { > > > > + error = !!(me->mm->flags && VM_NOHUGEPAGE); > > > > > > Should be: > > > > > > error = !!(me->mm->def_flags && VM_NOHUGEPAGE); > > > > No, we need to return 1 if this bit is set ;) > > Damn, you are right of course, we need "&". I didn't notice "&&" > in the patch I sent and misunderstood your "&&" above ;) Sorry.
Actually, I didn't catch that either! Looking at it, though, we definitely do want bitwise AND here, not logical.
However, what I was originally referring to is: Shouldn't we be checking mm->***def_flags*** for the VM_NOHUGEPAGE bit, as opposed to mm->flags? i.e. I think we want this:
error = !!(me->mm->def_flags & VM_NOHUGEPAGE);
As opposed to:
error = !!(me->mm->flags && VM_NOHUGEPAGE);
The way I understand it, the VM_NOHUGEPAGE bit is defined for mm->vma->flags, but not for mm->flags. Am I wrong here?
- Alex
| |