Skip to contentSkip to conversation

mem_cgroup_lru_del_before_commit_swapcache() seems broken

DISCUSSION Balbir Singh 1 participant 2 messages May 14, 2009 Memory management

lore
Share & tools
lore
#0 lore raw

Hi, Kame,

mem_cgroup_lru_del_before_commit_swapcache() seems to be broken, here is why

static void mem_cgroup_lru_del_before_commit_swapcache(struct page *page)

{
        unsigned long flags;
        struct zone *zone = page_zone(page);
        struct page_cgroup *pc = lookup_page_cgroup(page);

        spin_lock_irqsave(&zone->lru_lock, flags);
        /*
         * Forget old LRU when this page_cgroup is *not* used. This
         * Used bit
         * is guarded by lock_page() because the page is SwapCache.
         */
        if (!PageCgroupUsed(pc))
                mem_cgroup_del_lru_list(page, page_lru(page));

...
...
void mem_cgroup_del_lru_list(struct page *page, enum lru_list lru)

{
        struct page_cgroup *pc;
        struct mem_cgroup *mem;
        struct mem_cgroup_per_zone *mz;

        if (mem_cgroup_disabled())
                return;
        pc = lookup_page_cgroup(page);
        /* can happen while we handle swapcache. */
        if (!PageCgroupUsed(pc))
                return;

In mem_cgroup_lru_del_before_commit_swapcache() we say
if (!PageCgroupused(pc))
mem_cgroup_del_lru_list()

in mem_cgroup_del_lru_list() we say

        if (!PageCgroupUsed(pc))
                return;

So why call mem_cgroup_del_lru_list() at all? Am I missing something.

Signature · 7 lines
	Balbir

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
#1 lore raw
Quoted 42 lines · Balbir Singh

Hi, Kame,

mem_cgroup_lru_del_before_commit_swapcache() seems to be broken, here is why

static void mem_cgroup_lru_del_before_commit_swapcache(struct page *page)

{
        unsigned long flags;
        struct zone *zone = page_zone(page);
        struct page_cgroup *pc = lookup_page_cgroup(page);

        spin_lock_irqsave(&zone->lru_lock, flags);
        /*
         * Forget old LRU when this page_cgroup is *not* used. This
         * Used bit
         * is guarded by lock_page() because the page is SwapCache.
         */
        if (!PageCgroupUsed(pc))
                mem_cgroup_del_lru_list(page, page_lru(page));

...
...
void mem_cgroup_del_lru_list(struct page *page, enum lru_list lru)

{
        struct page_cgroup *pc;
        struct mem_cgroup *mem;
        struct mem_cgroup_per_zone *mz;

        if (mem_cgroup_disabled())
                return;
        pc = lookup_page_cgroup(page);
        /* can happen while we handle swapcache. */
        if (!PageCgroupUsed(pc))
                return;

In mem_cgroup_lru_del_before_commit_swapcache() we say
if (!PageCgroupused(pc))
mem_cgroup_del_lru_list()

Quoted 6 lines

in mem_cgroup_del_lru_list() we say

        if (!PageCgroupUsed(pc))
                return;

So why call mem_cgroup_del_lru_list() at all? Am I missing something.

Please ignore, looks like a badly applied diff, let the change over in my sources. Sorry for the noise

Signature · 7 lines
	Balbir

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>