Re: [PATCH 3/7 v2] mm: rework __isolate_lru_page() file/anon filter

From: KAMEZAWA Hiroyuki
Date: Thu Mar 08 2012 - 00:32:24 EST


On Tue, 6 Mar 2012 19:22:21 -0800 (PST)
Hugh Dickins <hughd@xxxxxxxxxx> wrote:

> On Sat, 3 Mar 2012, Konstantin Khlebnikov wrote:
>
> > This patch adds file/anon filter bits into isolate_mode_t,
> > this allows to simplify checks in __isolate_lru_page().
> >
> > v2:
> > * use switch () instead of if ()
> > * fixed lumpy-reclaim isolation mode
> >
> > Signed-off-by: Konstantin Khlebnikov <khlebnikov@xxxxxxxxxx>
>
> I'm sorry to be messing you around on this one, Konstantin, but...
>
> (a) if you do go with the switch statements,
> in kernel we align the "case"s underneath the "switch"
>
> but
>
> (b) I seem to be at odds with Kamezawa-san, I much preferred your
> original, which did in 2 lines what the switches do in 10 lines.
> And I'd say there's more opportunity for error in 10 lines than 2.
>
> What does the compiler say (4.5.1 here, OPTIMIZE_FOR_SIZE off)?
> text data bss dec hex filename
> 17723 113 17 17853 45bd vmscan.o.0
> 17671 113 17 17801 4589 vmscan.o.1
> 17803 113 17 17933 460d vmscan.o.2
>
> That suggests that your v2 is the worst and your v1 the best.
> Kame, can I persuade you to let the compiler decide on this?
>

Hmm. How about Costa' proposal ? as

int tmp_var = PageActive(page) ? ISOLATE_ACTIVE : ISOLATE_INACTIVE
if (!(mode & tmp_var))
ret;

Thanks,
-Kame


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