lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.LNX.2.00.1302191040010.2248@eggly.anvils>
Date:	Tue, 19 Feb 2013 10:49:40 -0800 (PST)
From:	Hugh Dickins <hughd@...gle.com>
To:	Sha Zhengju <handai.szj@...il.com>
cc:	Li Haifeng <omycle@...il.com>, Will Huck <will.huckk@...il.com>,
	linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
	linux-mm@...ck.org
Subject: Re: Should a swapped out page be deleted from swap cache?

On Tue, 19 Feb 2013, Sha Zhengju wrote:
> On Tue, Feb 19, 2013 at 2:53 PM, Li Haifeng <omycle@...il.com> wrote:
> > 2013/2/19 Will Huck <will.huckk@...il.com>:
> >> On 02/19/2013 10:04 AM, Li Haifeng wrote:
> >>>
> >>> If a anonymous page is swapped out and  comes to be reclaimable,
> >>> shrink_page_list() will call __remove_mapping() to delete the page
> >>> swapped out from swap cache. Corresponding code lists as below.

Correct.

> >>
> >>
> >> I'm not sure if
> >> if (PageAnon(page) && !PageSwapCache(page)) {
> >>  .................
> >> }
> >> will add the page to swap cache again.

No, it's already in the swap cache.  Of course, the original pageframe
may be removed from swap cache, freed, data later read back from swap into
a new swap cache pageframe, that be mapped into user memory, removed from
swap cache and swap freed, then later arrive here in page reclaim at the
PageAnon(page) && !PageSwapCache(page) to be added to swap again.

> >>
> >
> > Adding the page to swap cache is the first stage of memory reclaiming.
> >
> > When an anonymous page will be reclaimed, it should be swapped out. If
> > it's not in the swap cache, it will insert into swap cache first and
> > set the bit of PG_swapcache on page->flags. Then, it will be swapped
> > out by try_to_unmap(). After it's swapped out, and no processes swap

Almost correct...

> 
> Swapout(writing to swap disk) is not done by try_to_unmap() which only
> tries to remove all page table mappings to a page. Before unmapping,
> add_to_swap() will set the swap cache page dirty and it will be
> written out by pageout()->swap_writepage().

... but yes, try_to_unmap() is not the one that writes out to swap.

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ