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

Richard Jerrell (jerrell@missioncriticallinux.com)
Tue, 27 Mar 2001 18:10:36 -0500 (EST)


This message is in MIME format. The first part should be readable text,
while the remaining parts are likely unreadable without MIME-aware tools.
Send mail to mime@docserver.cac.washington.edu for more info.

--17458952-1753066538-985734636=:1989
Content-Type: TEXT/PLAIN; charset=US-ASCII

> 1. we take an extra reference on the page, how does that
> affect the test for if the page is shared or not ?

is_page_shared expects us to have our own reference to the page.

> 2. we call delete_from_swap_cache with the pagemap_lru_lock
> held, since this tries to grab the pagecache_lock we can
> easily deadlock with the rest of the kernel (where the
> locking order is opposite)

You're right. Oversight on my part. Here is another version of the
patch.

> 3. there are no comments in the code explaining what this
> suspicious-looking piece of code does ;)

Oops... I sent out the wrong version of the patch the first time. This
one has comments, promise. And it has one less bug. :)

Rich

--17458952-1753066538-985734636=:1989
Content-Type: TEXT/PLAIN; charset=US-ASCII; name="2.4.1-paging-fix-27.03.01.patch"
Content-Transfer-Encoding: BASE64
Content-ID: <Pine.LNX.4.21.0103271810360.1989@jerrell.lowell.mclinux.com>
Content-Description:
Content-Disposition: attachment; filename="2.4.1-paging-fix-27.03.01.patch"

ZGlmZiAtck51IGxpbnV4LTIuNC4xL2luY2x1ZGUvbGludXgvc3dhcC5oIGxp
bnV4LTIuNC4xLXBhZ2luZy1maXgvaW5jbHVkZS9saW51eC9zd2FwLmgNCi0t
LSBsaW51eC0yLjQuMS9pbmNsdWRlL2xpbnV4L3N3YXAuaAlUdWUgSmFuIDMw
IDAyOjI0OjU2IDIwMDENCisrKyBsaW51eC0yLjQuMS1wYWdpbmctZml4L2lu
Y2x1ZGUvbGludXgvc3dhcC5oCVR1ZSBNYXIgMjcgMTQ6MDA6MTcgMjAwMQ0K
QEAgLTY5LDYgKzY5LDcgQEANCiBGQVNUQ0FMTCh1bnNpZ25lZCBpbnQgbnJf
ZnJlZV9idWZmZXJfcGFnZXModm9pZCkpOw0KIGV4dGVyb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hY2hlX3JlbGVhc2UocGFnZSk7DQogCQl9DQogDQogCQkvKiBEbyBhZ2lu
ZyBvbiB0aGUgcGFnZXMuICovDQo=
--17458952-1753066538-985734636=:1989--
-
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/