Skip to contentSkip to conversation

VM_BUG_ON_PGFLAGS with CONFIG_DEBUG_VM_PGFLAGS=n

DISCUSSION Michal Hocko 2 participants 3 messages Sep 5, 2018 Memory management

lore
Share & tools
lore
#0 lore raw

Hi Kirill,
while looking at something unrelated I have stumbled over %subj and I simply do not understand how BUILD_BUG_ON_INVALID is supposed to work for page flags checks which are dynamic by definition. BUILD_BUG_ON_INVALID is noop without any side effects unless __CHECKER__ is enabled when it evaluates to ((void )(sizeof((__force long )(e)))). How is this supposed to work? Am I just confused or BUILD_BUG_ON_INVALID is simply not a good fit here and all you wanted is the no side-effect nature of it?

Thanks!

Signature · 2 lines
Michal Hocko
SUSE Labs
#1 lore raw
Quoted 6 lines · Michal Hocko

Hi Kirill,
while looking at something unrelated I have stumbled over %subj and I simply do not understand how BUILD_BUG_ON_INVALID is supposed to work for page flags checks which are dynamic by definition. BUILD_BUG_ON_INVALID is noop without any side effects unless __CHECKER__ is enabled when it evaluates to ((void )(sizeof((__force long )(e)))).

You've read it backwards. BUILD_BUG_ON_INVALID() is not if __CHECKER__ is enabled.

Quoted 3 lines

How is this supposed to work? Am I just confused or BUILD_BUG_ON_INVALID is simply not a good fit here and all you wanted is the no side-effect nature of it?

Without CONFIG_DEBUG_VM_PGFLAGS() is basically nop. BUILD_BUG_ON_INVALID() here is fance version of nop that check that what you've wrote inside parses fine. That's it.

Signature · 1 line
 Kirill A. Shutemov
#2 lore raw
Quoted 10 lines · Kirill A. Shutemov
Quoted 6 lines · Michal Hocko

Hi Kirill,
while looking at something unrelated I have stumbled over %subj and I simply do not understand how BUILD_BUG_ON_INVALID is supposed to work for page flags checks which are dynamic by definition. BUILD_BUG_ON_INVALID is noop without any side effects unless __CHECKER__ is enabled when it evaluates to ((void )(sizeof((__force long )(e)))).

You've read it backwards. BUILD_BUG_ON_INVALID() is not if __CHECKER__ is enabled.

Well, that is what I meant I just reworded the text and kept the negation...

Quoted 7 lines
Quoted 3 lines

How is this supposed to work? Am I just confused or BUILD_BUG_ON_INVALID is simply not a good fit here and all you wanted is the no side-effect nature of it?

Without CONFIG_DEBUG_VM_PGFLAGS() is basically nop. BUILD_BUG_ON_INVALID() here is fance version of nop that check that what you've wrote inside parses fine. That's it.

OK, I see it. I somehow implied that this is similar to BUILD_BUG_ON. If this is about pure expression correctness then it finally makes some sense to me.

Thanks!

Signature · 2 lines
Michal Hocko
SUSE Labs