lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20121221004935.GC2686@blaptop>
Date:	Fri, 21 Dec 2012 09:49:35 +0900
From:	Minchan Kim <minchan@...nel.org>
To:	Mel Gorman <mgorman@...e.de>
Cc:	Andrew Morton <akpm@...ux-foundation.org>, linux-mm@...ck.org,
	linux-kernel@...r.kernel.org,
	Marek Szyprowski <m.szyprowski@...sung.com>
Subject: Re: [PATCH] compaction: fix build error in CMA && !COMPACTION

On Thu, Dec 20, 2012 at 10:47:07AM +0000, Mel Gorman wrote:
> On Thu, Dec 20, 2012 at 02:25:30PM +0900, Minchan Kim wrote:
> > isolate_freepages_block and isolate_migratepages_range is used for CMA
> > as well as compaction so it breaks build for CONFIG_CMA &&
> > !CONFIG_COMPACTION.
> > 
> > This patch fixes it.
> > 
> > Cc: Mel Gorman <mgorman@...e.de>
> > Cc: Marek Szyprowski <m.szyprowski@...sung.com>
> > Signed-off-by: Minchan Kim <minchan@...nel.org>
> > ---
> >  mm/compaction.c |   26 ++++++++++++++++++++------
> >  1 file changed, 20 insertions(+), 6 deletions(-)
> > 
> > diff --git a/mm/compaction.c b/mm/compaction.c
> > index 5ad7f4f..70f4443 100644
> > --- a/mm/compaction.c
> > +++ b/mm/compaction.c
> > @@ -17,6 +17,21 @@
> >  #include <linux/balloon_compaction.h>
> >  #include "internal.h"
> >  
> > +#ifdef CONFIG_COMPACTION
> > +static inline void count_compact_event(enum vm_event_item item)
> > +{
> > +	count_vm_event(item);
> > +}
> > +
> > +static inline void count_compact_events(enum vm_event_item item, long delta)
> > +{
> > +	count_vm_events(item, delta);
> > +}
> > +#else
> > +#define count_compact_event(item)
> > +#define count_compact_events(item, delta)
> > +#endif
> > +
> 
> That should be
> 
> do {} while (0)
> 
> otherwise a block like this
> 
> if (foo)
> 	count_compact_event(COMPACTFREE_SCANNED)
> bar;
> 
> will get parsed as
> 
> if (foo)
> 	bar;
> 
> which is wrong.

Indeed.

> 
> Now that I look at the do {} while (0) thing it is also strictly speaking
> wrong for count_vm_numa_events() too because it would do the wrong thing for

If I noticed it, I should named it as count_vm_compact_events for the consistency.

> 
> count_compact_events(COMPACTFREE_SCANNED, foo++);
> 
> There happens to be no examples where we depend on such side-effects but

Agreed.

> I've taken a TODO item to fix it up in the New Year.

Andrew picked up the patch with your fix. Please correct it for New Year's
present. :)

Thanks, Mel.

> 
> -- 
> Mel Gorman
> SUSE Labs
> 
> --
> To unsubscribe, send a message with 'unsubscribe linux-mm' in
> the body to majordomo@...ck.org.  For more info on Linux MM,
> see: http://www.linux-mm.org/ .
> Don't email: <a href=mailto:"dont@...ck.org"> email@...ck.org </a>

-- 
Kind regards,
Minchan Kim
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ