All of lore.kernel.org
 help / color / mirror / Atom feed
* VM_BUG_ON_PGFLAGS with CONFIG_DEBUG_VM_PGFLAGS=n
@ 2018-09-05  6:48 Michal Hocko
  2018-09-05 13:26 ` Kirill A. Shutemov
  0 siblings, 1 reply; 3+ messages in thread
From: Michal Hocko @ 2018-09-05  6:48 UTC (permalink / raw)
  To: Kirill A. Shutemov; +Cc: linux-mm

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!
-- 
Michal Hocko
SUSE Labs

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: VM_BUG_ON_PGFLAGS with CONFIG_DEBUG_VM_PGFLAGS=n
  2018-09-05  6:48 VM_BUG_ON_PGFLAGS with CONFIG_DEBUG_VM_PGFLAGS=n Michal Hocko
@ 2018-09-05 13:26 ` Kirill A. Shutemov
  2018-09-05 13:46   ` Michal Hocko
  0 siblings, 1 reply; 3+ messages in thread
From: Kirill A. Shutemov @ 2018-09-05 13:26 UTC (permalink / raw)
  To: Michal Hocko; +Cc: linux-mm

On Wed, Sep 05, 2018 at 08:48:00AM +0200, Michal Hocko wrote:
> 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.

> 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.

-- 
 Kirill A. Shutemov

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: VM_BUG_ON_PGFLAGS with CONFIG_DEBUG_VM_PGFLAGS=n
  2018-09-05 13:26 ` Kirill A. Shutemov
@ 2018-09-05 13:46   ` Michal Hocko
  0 siblings, 0 replies; 3+ messages in thread
From: Michal Hocko @ 2018-09-05 13:46 UTC (permalink / raw)
  To: Kirill A. Shutemov; +Cc: linux-mm

On Wed 05-09-18 16:26:13, Kirill A. Shutemov wrote:
> On Wed, Sep 05, 2018 at 08:48:00AM +0200, Michal Hocko wrote:
> > 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...

> > 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!
-- 
Michal Hocko
SUSE Labs

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-09-05 13:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-05  6:48 VM_BUG_ON_PGFLAGS with CONFIG_DEBUG_VM_PGFLAGS=n Michal Hocko
2018-09-05 13:26 ` Kirill A. Shutemov
2018-09-05 13:46   ` Michal Hocko

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.