kernel - MPSAFE work - Remove token acquires/releases from vm_zeroidle.c
authorVenkatesh Srinivas <me@endeavour.zapto.org>
Mon, 14 Jun 2010 12:59:51 +0000 (05:59 -0700)
committerVenkatesh Srinivas <me@endeavour.zapto.org>
Mon, 14 Jun 2010 12:59:51 +0000 (05:59 -0700)
We do not need the vm_token to get or release pages to/from the free queues;
the vm_page calls are self-synchronizing.

sys/vm/vm_zeroidle.c

index 4f969e9..7c05876 100644 (file)
@@ -185,11 +185,8 @@ vm_pagezero(void __unused *arg)
                        /*
                         * Acquire page to zero
                         */
-                       if (lwkt_trytoken(&vm_token) == 0) {
+                       if (--npages == 0) {
                                state = STATE_IDLE;
-                       } else if (--npages == 0) {
-                               state = STATE_IDLE;
-                               lwkt_reltoken(&vm_token);
                        } else {
                                m = vm_page_free_fromq_fast();
                                if (m == NULL) {
@@ -200,7 +197,6 @@ vm_pagezero(void __unused *arg)
                                        pg = (char *)lwbuf_kva(buf);
                                        i = 0;
                                }
-                               lwkt_reltoken(&vm_token);
                        }
                        break;
                case STATE_ZERO_PAGE:
@@ -221,14 +217,11 @@ vm_pagezero(void __unused *arg)
                                state = STATE_RELEASE_PAGE;
                        break;
                case STATE_RELEASE_PAGE:
-                       if (lwkt_trytoken(&vm_token)) {
-                               lwbuf_free(buf);
-                               vm_page_flag_set(m, PG_ZERO);
-                               vm_page_free_toq(m);
-                               state = STATE_GET_PAGE;
-                               ++idlezero_count;
-                               lwkt_reltoken(&vm_token);
-                       }
+                       lwbuf_free(buf);
+                       vm_page_flag_set(m, PG_ZERO);
+                       vm_page_free_toq(m);
+                       state = STATE_GET_PAGE;
+                       ++idlezero_count;
                        break;
                }
                if (lwkt_check_resched(curthread))