lkml.org 
[lkml]   [2008]   [Mar]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [patch 02/20] Use an indexed array for LRU variables
Date
Hi Rik,

Rik van Riel <riel@redhat.com> writes:

> Index: linux-2.6.25-rc3-mm1/include/linux/mmzone.h
> ===================================================================
> --- linux-2.6.25-rc3-mm1.orig/include/linux/mmzone.h 2008-03-04 14:12:52.000000000 -0500
> +++ linux-2.6.25-rc3-mm1/include/linux/mmzone.h 2008-03-04 14:59:31.000000000 -0500
> @@ -80,8 +80,8 @@ struct zone_padding {
> enum zone_stat_item {
> /* First 128 byte cacheline (assuming 64 bit words) */
> NR_FREE_PAGES,
> - NR_INACTIVE,
> - NR_ACTIVE,
> + NR_INACTIVE, /* must match order of LRU_[IN]ACTIVE */
> + NR_ACTIVE, /* " " " " " */
> NR_ANON_PAGES, /* Mapped anonymous pages */
> NR_FILE_MAPPED, /* pagecache pages mapped into pagetables.
> only modified from process context */
> @@ -105,6 +105,13 @@ enum zone_stat_item {
> #endif
> NR_VM_ZONE_STAT_ITEMS };

How about a #define LRU_STAT_BASE NR_INACTIVE ...

> Index: linux-2.6.25-rc3-mm1/include/linux/mm_inline.h
> ===================================================================
> --- linux-2.6.25-rc3-mm1.orig/include/linux/mm_inline.h 2007-07-08 19:32:17.000000000 -0400
> +++ linux-2.6.25-rc3-mm1/include/linux/mm_inline.h 2008-03-04 14:59:31.000000000 -0500
> @@ -1,40 +1,51 @@
> static inline void
> +add_page_to_lru_list(struct zone *zone, struct page *page, enum lru_list l)
> +{
> + list_add(&page->lru, &zone->list[l]);
> + __inc_zone_state(zone, NR_INACTIVE + l);

... in order to avoid using NR_INACTIVE in places like this?

(LRU_STAT_BASE is a bad name, I apologize)

Or perhaps a macro lru_stat (it's getting worse...) that yields the zone
stat index corresponding to the lru list type? I think this would
increase readability.

Hannes


\
 
 \ /
  Last update: 2008-03-05 01:35    [from the cache]
©2003-2011 Jasper Spaans