Re: [PATCH] - GRU Driver V3 fixes to resolve code review comments

From: Nick Piggin
Date: Mon Jul 28 2008 - 22:02:30 EST


On Tuesday 29 July 2008 06:05, Jack Steiner wrote:

> Index: linux/drivers/misc/sgi-gru/grutlbpurge.c
> ===================================================================
> --- linux.orig/drivers/misc/sgi-gru/grutlbpurge.c 2008-07-28
> 14:52:26.000000000 -0500 +++
> linux/drivers/misc/sgi-gru/grutlbpurge.c 2008-07-28 14:52:54.000000000
> -0500 @@ -242,7 +242,9 @@ static void gru_invalidate_range_end(str
> struct gru_mm_struct *gms = container_of(mn, struct gru_mm_struct,
> ms_notifier);
>
> - atomic_dec(&gms->ms_range_active);
> + /* ..._and_test() provides needed barrier */
> + (void)atomic_dec_and_test(&gms->ms_range_active);
> +
> wake_up_all(&gms->ms_wait_queue);

What about

if (atomic_dec_and_test())
wake_up_all()
?

Also, I would prefer either a comment to say why the increment of
ms_range_active is safe, or an smp_mb__after_atomic_inc() for it too.
--
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/