Re: [guv v2 23/31] tile: Replace __get_cpu_var uses

From: Chris Metcalf
Date: Mon Aug 26 2013 - 18:22:28 EST


On 8/26/2013 4:56 PM, Christoph Lameter wrote:
> Index: linux/arch/tile/include/asm/irqflags.h
> ===================================================================
> --- linux.orig/arch/tile/include/asm/irqflags.h 2013-08-22 14:39:14.000000000 -0500
> +++ linux/arch/tile/include/asm/irqflags.h 2013-08-22 14:39:57.453305409 -0500

Nack to the changes to this file, with all due respect :-), since I have conflicting changes in the linux-tile tree that also remove all uses of __get_cpu_var from this file. Note that there are places in this file where "this_cpu_and", etc., make sense; I don't know if it makes sense for your script to be looking for this kind of thing more generally.

> - __get_cpu_var(current_asid) = asid;
> + __this_cpu_read(current_asid) = asid;

This should be __this_cpu_write(current_asid, asid). You caught this idiom elsewhere so not sure if it was a script bug that caused it to be missed here?

> - int depth = __get_cpu_var(irq_depth)++;
> + int depth = __this_cpu_inc_return(irq_depth) - 1;

I would omit the "-1" here and instead change the one test of "depth == 0" to be "depth == 1".

> - __get_cpu_var(current_asid) = min_asid = asid_range.start;
> + __this_cpu_write(current_asid, min_asid = asid_range.start);

This was ugly before but now it's much worse :-) Please just split it into an assignment to min_asid, then use __this_cpu_write() with min_asid. Thanks.

The rest is fine. Would it make more sense for me to fold all these changes into the tile tree and just have it meet in linux-next? There are certainly a bunch of other changes staged there which likely also include more uses of __get_cpu_var...

--
Chris Metcalf, Tilera Corp.
http://www.tilera.com

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