public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [Patch] statistics: fix sorted list
@ 2007-04-14  8:42 Martin Peschke
  0 siblings, 0 replies; only message in thread
From: Martin Peschke @ 2007-04-14  8:42 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel, linux-s390

The list of statistics entries maintained by type 'sparse' might have
shown unsorted entries with regard to the number of reported hits. The
reason was that new entries were always added at the tail of the list
regardless of the number of hits they came with. Unsorted lists might
suffer a performance loss.

Fix is to sort the list by hits after entry insertion, i.e. moving
entries added at the tail up the chain, which should not be required
very often (usually just when merging per-cpu lists).

Patch is against 2.6.21-rc6-mm1.

Signed-off-by: Martin Peschke <mp3@de.ibm.com>
---

 statistic.c |    1 +
 1 file changed, 1 insertion(+)

Index: linux/lib/statistic.c
===================================================================
--- linux.orig/lib/statistic.c
+++ linux/lib/statistic.c
@@ -1113,6 +1113,7 @@ static int statistic_add_sparse_new(stru
 	entry->hits = incr;
 	slist->entries++;
 	list_add_tail(&entry->list, &slist->entry_lh);
+	statistic_sort_sparse(&slist->entry_lh, entry);
 	return 0;
 }
 



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2007-04-14  8:42 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-04-14  8:42 [Patch] statistics: fix sorted list Martin Peschke

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox