mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* free_swap_and_cache() doubt
@ 2002-01-19 13:47 alad
  2002-01-21  0:15 ` Hugh Dickins
  0 siblings, 1 reply; 2+ messages in thread
From: alad @ 2002-01-19 13:47 UTC (permalink / raw)
  To: linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1229 bytes --]




Hi,
  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.

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 ??

-----
Amol


void free_swap_and_cache(swp_entry_t entry)
{
        struct swap_info_struct * p;
        struct page *page = NULL;

        p = swap_info_get(entry);
        if (p) {
                if (swap_entry_free(p, SWP_OFFSET(entry)) == 1)
                        page = find_trylock_page(&swapper_space, entry.val);
                swap_info_put(p);
        }
        if (page) {
                page_cache_get(page);
                /* Only cache user (+us), or swap space full? Free it! */
                if (page_count(page) == 2 || vm_swap_full()) {
                        delete_from_swap_cache(page);
                        SetPageDirty(page);
                }
                UnlockPage(page);
                page_cache_release(page);
        }
}

[-- Attachment #2: Type: text/plain, Size: 671 bytes --]


?


"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."




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2002-01-21  0:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-01-19 13:47 free_swap_and_cache() doubt alad
2002-01-21  0:15 ` Hugh Dickins

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®