Re: [PATCH] mm/memory.c, 2.4.1 : memory leak with swap cache (updated)

From: Richard Jerrell (jerrell@missioncriticallinux.com)
Date: Fri Mar 23 2001 - 11:32:41 EST


> Your idea is nice, but the patch lacks a few things:
>
> - SMP locking, what if some other process faults in this page
> between the atomic_read of the page count and the test later?

It can't happen. free_pte is called with the page_table_lock held in
addition to having the mmap_sem downed.

> - testing if our process is the _only_ user of this swap page,
> for eg. apache you'll have lots of COW-shared pages .. it would
> be good to keep the page in memory for our siblings

This is already done in free_page_and_swap_cache.

There is a problem with a possible kernel panic in that
try_to_free_buffers is called with a wait of 1 (thanks to Andrew Morton
for pointing that out) and we might reschedule while we wait on io. So,
to fix it, here is an even newer (and simpler) patch. Everything is
handled in free_page_and_swap_cache, so we just call that if we can
successfully look up the entry.

Rich



-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Fri Mar 23 2001 - 21:00:21 EST