Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/net Tweak mutex_enter(softnet_lock) position



details:   https://anonhg.NetBSD.org/src/rev/c13540b51305
branches:  trunk
changeset: 340741:c13540b51305
user:      ozaki-r <ozaki-r%NetBSD.org@localhost>
date:      Mon Sep 28 07:55:26 2015 +0000

description:
Tweak mutex_enter(softnet_lock) position

The previous code took locks the following order:
- LLE_WLOCKs
- mutex_enter(softnet_lock)
- LLE_WUNLOCKs
- mutex_exit(softnet_lock)

This fix moves mutex_enter(softnet_lock) before LLE_WLOCKs.

diffstat:

 sys/net/if_llatbl.c |  4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diffs (25 lines):

diff -r ff0bce6607b4 -r c13540b51305 sys/net/if_llatbl.c
--- a/sys/net/if_llatbl.c       Mon Sep 28 07:02:57 2015 +0000
+++ b/sys/net/if_llatbl.c       Mon Sep 28 07:55:26 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_llatbl.c,v 1.4 2015/09/09 01:26:50 ozaki-r Exp $    */
+/*     $NetBSD: if_llatbl.c,v 1.5 2015/09/28 07:55:26 ozaki-r Exp $    */
 /*
  * Copyright (c) 2004 Luigi Rizzo, Alessandro Cerri. All rights reserved.
  * Copyright (c) 2004-2008 Qing Li. All rights reserved.
@@ -364,6 +364,7 @@
 
        lltable_unlink(llt);
 
+       mutex_enter(softnet_lock);
        LIST_INIT(&dchain);
        IF_AFDATA_WLOCK(llt->llt_ifp);
        /* Push all lles to @dchain */
@@ -371,7 +372,6 @@
        llentries_unlink(llt, &dchain);
        IF_AFDATA_WUNLOCK(llt->llt_ifp);
 
-       mutex_enter(softnet_lock);
        LIST_FOREACH_SAFE(lle, &dchain, lle_chain, next) {
                if (callout_halt(&lle->la_timer, softnet_lock))
                        LLE_REMREF(lle);



Home | Main Index | Thread Index | Old Index