Re: [PATCH 2/2] vmscan: use atomic-long for shrinker batching

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

 



Konstantin Khlebnikov wrote:
  		delta = (4 * nr_pages_scanned) / shrinker->seeks;
@@ -329,12 +327,11 @@ unsigned long shrink_slab(struct shrink_control *shrink,
  		 * manner that handles concurrent updates. If we exhausted the
  		 * scan, there is no need to do an update.
  		 */
-		do {
-			nr = shrinker->nr;
-			new_nr = total_scan + nr;
-			if (total_scan<= 0)
-				break;
-		} while (cmpxchg(&shrinker->nr, nr, new_nr) != nr);
+		if (total_scan>  0)
+			new_nr = atomic_long_add_return(total_scan,
+					&shrinker->nr_in_batch);
+		else
+			new_nr = atomic_long_read(&shrinker->nr_in_batch);

  		trace_mm_shrink_slab_end(shrinker, shrink_ret, nr, new_nr);

BTW, new_nr required only for tracing, maybe this will be better/faster,
because atomic accuracy there isn't required at all.

	if (total_scan > 0)
		atomic_long_add(total_scan, &shrinker->nr_in_batch);

	new_nr = atomic_long_read(&shrinker->nr_in_batch);
	trace_mm_shrink_slab_end(shrinker, shrink_ret, nr, new_nr);

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>


[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]