Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 115835
b: refs/heads/master
c: b69408e
h: refs/heads/master
i:
  115833: 5c6872b
  115831: 3a871fd
v: v3
  • Loading branch information
Christoph Lameter authored and Linus Torvalds committed Oct 20, 2008
1 parent babdefb commit 00cabe7
Show file tree
Hide file tree
Showing 9 changed files with 172 additions and 171 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 62695a84eb8f2e718bf4dfb21700afaa7a08e0ea
refs/heads/master: b69408e88bd86b98feb7b9a38fd865e1ddb29827
17 changes: 5 additions & 12 deletions trunk/include/linux/memcontrol.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,8 @@ extern void mem_cgroup_note_reclaim_priority(struct mem_cgroup *mem,
extern void mem_cgroup_record_reclaim_priority(struct mem_cgroup *mem,
int priority);

extern long mem_cgroup_calc_reclaim_active(struct mem_cgroup *mem,
struct zone *zone, int priority);
extern long mem_cgroup_calc_reclaim_inactive(struct mem_cgroup *mem,
struct zone *zone, int priority);
extern long mem_cgroup_calc_reclaim(struct mem_cgroup *mem, struct zone *zone,
int priority, enum lru_list lru);

#else /* CONFIG_CGROUP_MEM_RES_CTLR */
static inline void page_reset_bad_cgroup(struct page *page)
Expand Down Expand Up @@ -159,14 +157,9 @@ static inline void mem_cgroup_record_reclaim_priority(struct mem_cgroup *mem,
{
}

static inline long mem_cgroup_calc_reclaim_active(struct mem_cgroup *mem,
struct zone *zone, int priority)
{
return 0;
}

static inline long mem_cgroup_calc_reclaim_inactive(struct mem_cgroup *mem,
struct zone *zone, int priority)
static inline long mem_cgroup_calc_reclaim(struct mem_cgroup *mem,
struct zone *zone, int priority,
enum lru_list lru)
{
return 0;
}
Expand Down
49 changes: 38 additions & 11 deletions trunk/include/linux/mm_inline.h
Original file line number Diff line number Diff line change
@@ -1,40 +1,67 @@
static inline void
add_page_to_lru_list(struct zone *zone, struct page *page, enum lru_list l)
{
list_add(&page->lru, &zone->lru[l].list);
__inc_zone_state(zone, NR_LRU_BASE + l);
}

static inline void
del_page_from_lru_list(struct zone *zone, struct page *page, enum lru_list l)
{
list_del(&page->lru);
__dec_zone_state(zone, NR_LRU_BASE + l);
}

static inline void
add_page_to_active_list(struct zone *zone, struct page *page)
{
list_add(&page->lru, &zone->active_list);
__inc_zone_state(zone, NR_ACTIVE);
add_page_to_lru_list(zone, page, LRU_ACTIVE);
}

static inline void
add_page_to_inactive_list(struct zone *zone, struct page *page)
{
list_add(&page->lru, &zone->inactive_list);
__inc_zone_state(zone, NR_INACTIVE);
add_page_to_lru_list(zone, page, LRU_INACTIVE);
}

static inline void
del_page_from_active_list(struct zone *zone, struct page *page)
{
list_del(&page->lru);
__dec_zone_state(zone, NR_ACTIVE);
del_page_from_lru_list(zone, page, LRU_ACTIVE);
}

static inline void
del_page_from_inactive_list(struct zone *zone, struct page *page)
{
list_del(&page->lru);
__dec_zone_state(zone, NR_INACTIVE);
del_page_from_lru_list(zone, page, LRU_INACTIVE);
}

static inline void
del_page_from_lru(struct zone *zone, struct page *page)
{
enum lru_list l = LRU_INACTIVE;

list_del(&page->lru);
if (PageActive(page)) {
__ClearPageActive(page);
__dec_zone_state(zone, NR_ACTIVE);
} else {
__dec_zone_state(zone, NR_INACTIVE);
l = LRU_ACTIVE;
}
__dec_zone_state(zone, NR_LRU_BASE + l);
}

/**
* page_lru - which LRU list should a page be on?
* @page: the page to test
*
* Returns the LRU list a page should be on, as an index
* into the array of LRU lists.
*/
static inline enum lru_list page_lru(struct page *page)
{
enum lru_list lru = LRU_BASE;

if (PageActive(page))
lru += LRU_ACTIVE;

return lru;
}
26 changes: 20 additions & 6 deletions trunk/include/linux/mmzone.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,9 @@ struct zone_padding {
enum zone_stat_item {
/* First 128 byte cacheline (assuming 64 bit words) */
NR_FREE_PAGES,
NR_INACTIVE,
NR_ACTIVE,
NR_LRU_BASE,
NR_INACTIVE = NR_LRU_BASE, /* 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 */
Expand All @@ -107,6 +108,19 @@ enum zone_stat_item {
#endif
NR_VM_ZONE_STAT_ITEMS };

enum lru_list {
LRU_BASE,
LRU_INACTIVE=LRU_BASE, /* must match order of NR_[IN]ACTIVE */
LRU_ACTIVE, /* " " " " " */
NR_LRU_LISTS };

#define for_each_lru(l) for (l = 0; l < NR_LRU_LISTS; l++)

static inline int is_active_lru(enum lru_list l)
{
return (l == LRU_ACTIVE);
}

struct per_cpu_pages {
int count; /* number of pages in the list */
int high; /* high watermark, emptying needed */
Expand Down Expand Up @@ -251,10 +265,10 @@ struct zone {

/* Fields commonly accessed by the page reclaim scanner */
spinlock_t lru_lock;
struct list_head active_list;
struct list_head inactive_list;
unsigned long nr_scan_active;
unsigned long nr_scan_inactive;
struct {
struct list_head list;
unsigned long nr_scan;
} lru[NR_LRU_LISTS];
unsigned long pages_scanned; /* since last reclaim */
unsigned long flags; /* zone flags, see below */

Expand Down
Loading

0 comments on commit 00cabe7

Please sign in to comment.