2002-01-19 13:54:04

by alad

[permalink] [raw]
Subject: free_swap_and_cache() doubt


?


"DISCLAIMER: This message is proprietary to Hughes Software Systmes Limited
(HSS) and/or its customers and intended solely for the use of the individual or
organisation to whom it is addressed. It may contain privileged or confidential
information. If you have received this message in error, please notify the
originator immediately. If you are not the intended recipient, you are notified
that you are strictly prohibited from using, copying, altering, or disclosing
the contents of this message. HSS accepts no responsibility for loss or damage
arising from the use of the information transimitted by this email including
damage from virus."




Attachments:
(No filename) (1.20 kB)
(No filename) (655.00 B)
Download all attachments

2002-01-21 00:13:58

by Hugh Dickins

[permalink] [raw]
Subject: Re: free_swap_and_cache() doubt

On Sat, 19 Jan 2002 [email protected] wrote:
> I am reading 2.4.16, let us assume following scenario
>
> swap_map[offset] == 2;
> and page->count == 2; (before function execution)
> vm_swap is full (nr_swap_pages*2 > total_swap_pages);
>
> first question is the above case possible.

Yes.

> if yes, then
> after execution of this function, we would have page->count == 1, i.e.
> mapped by some process, with good page->index and what we have is, the
> associated swap entry is already freed.
>
> Am i wrong somewhere ??

The only place you are wrong is in using the word "good" of page->index
at the end, and indeed I think your point is that it's not good. It is
not good, it is stale, but that's okay because page->mapping has been
set to NULL, and page->index has no meaning without page->mapping.

You'll notice that __free_pages_ok() contains many BUG() hurdles
(including check on page->mapping and redundant check on PageSwapCache)
but doesn't mind if page->index is non-zero.

But thanks for making me look at this function, there
is a bug there and I'll post a patch for it right now...

Hugh