[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.DEB.1.10.0905012257510.32364@qirst.com>
Date: Fri, 1 May 2009 23:00:21 -0400 (EDT)
From: Christoph Lameter <cl@...ux.com>
To: Mathieu Desnoyers <compudj@...stal.dyndns.org>
cc: Nick Piggin <nickpiggin@...oo.com.au>,
Peter Zijlstra <a.p.zijlstra@...llo.nl>,
Yuriy Lalym <ylalym@...il.com>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
ltt-dev@...ts.casi.polymtl.ca, Tejun Heo <tj@...nel.org>,
Ingo Molnar <mingo@...e.hu>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: [ltt-dev] [PATCH] Fix dirty page accounting in
redirty_page_for_writepage()
On Fri, 1 May 2009, Mathieu Desnoyers wrote:
> Then, if I understand you correctly, you propose :
>
> void __inc_zone_state(struct zone *zone, enum zone_stat_item item)
> {
> ... assuming p references percpu "u8" counters ...
> u8 p_new;
>
> p_new = percpu_add_return(p, 1);
>
> if (unlikely(!(p_new & pcp->stat_threshold_mask)))
> zone_page_state_add(pcp->stat_threshold, zone, item);
> }
>
> void inc_zone_state(struct zone *zone, enum zone_stat_item item)
> {
> ... assuming p references percpu "u8" counters ...
> u8 p_new;
>
> p_new = percpu_add_return_irqsafe(p, 1);
>
> if (unlikely(!(p_new & pcp->stat_threshold_mask)))
> zone_page_state_add(pcp->stat_threshold, zone, item);
> }
>
> (therefore opting for code duplication)
>
> Am I correct ?
Well __inc_zone_state is fine by itself. inc_zone_state will currently
disable irqs. But we can do it your way and duplicate the code.
> void __inc_zone_state(struct zone *zone, enum zone_stat_item item)
> {
> ... assuming p references percpu "u8" counters ...
> u8 p_new;
>
> p_new = __percpu_add_return_irqsafe(p, 1);
>
> if (unlikely(!(p_new & pcp->stat_threshold_mask)))
> zone_page_state_add(pcp->stat_threshold, zone, item);
> }
>
> void inc_zone_state(struct zone *zone, enum zone_stat_item item)
> {
> unsigned long flags;
>
> percpu_local_irqsave(flags);
> __inc_zone_state(zone, item);
> percpu_local_irqrestore(flags);
> }
>
> Which is more compact and does not duplicate code.
This is almost like the current code. But lets avoid percpu_local_irqs
etc if we can.
--
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