linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Minchan Kim <minchan@kernel.org>
To: Hugh Dickins <hughd@google.com>,
	Andrew Morton <akpm@linux-foundation.org>
Cc: "Darrick J . Wong" <darrick.wong@oracle.com>,
	Hyeoncheol Lee <cheol.lee@lge.com>,
	yjay.kim@lge.com, linux-kernel@vger.kernel.org,
	linux-mm@kvack.org
Subject: [PATCH v2] mm: support anonymous stable page
Date: Mon, 21 Nov 2016 08:30:16 +0900	[thread overview]
Message-ID: <20161120233015.GA14113@bbox> (raw)

On Fri, Nov 18, 2016 at 01:26:59PM -0800, Hugh Dickins wrote:
> On Fri, 18 Nov 2016, Minchan Kim wrote:
> > On Thu, Nov 17, 2016 at 08:35:10PM -0800, Hugh Dickins wrote:
> > > 
> > > Maybe add SWP_STABLE_WRITES in include/linux/swap.h, and set that
> > > in swap_info->flags according to bdi_cap_stable_pages_required(),
> > > leaving mapping->host itself NULL as before?
> > 
> > The problem with the approach is that we need to get swap_info_struct
> > in reuse_swap_page so maybe, every caller should pass swp_entry_t
> > into reuse_swap_page. It would be no problem if swap slot is really
> > referenced the page(IOW, pte is real swp_entry_t) but some cases
> > where swap slot is already empty but the page remains in only
> > swap cache, we cannot pass swp_entry_t which means that we cannot
> > get swap_info_struct.
> 
> I don't see the problem: if the page is PageSwapCache (and page
> lock is held), then the swp_entry_t is there in page->private:
> see page_swapcount(), which reuse_swap_page() just called.

Right you are!!

> 
> > 
> > So, if I didn't miss, another option I can imagine is to move
> > SWP_STABLE_WRITES to address_space->flags as AS_STABLE_WRITES.
> > With that, we can always get the information without passing
> > swp_entry_t. Is there any better idea?
> 
> I think what you suggest below would work fine (and be quicker
> than looking up the swap_info again): but is horribly misleading
> for anyone else interested in stable writes, for whom the info is
> kept in the bdi, and not in this new mapping flag.
> 
> So I'd much prefer that you keep the swap special case inside the
> world of swap, with a SWP_STABLE_WRITES flag.  Maybe unfold
> page_swapcount() inside reuse_swap_page(), so that it only
> needs a single lookup (or perhaps I'm optimizing prematurely).
> 

I toally agree.
Here is new one.

             reply	other threads:[~2016-11-20 23:30 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-20 23:30 Minchan Kim [this message]
2016-11-22  3:46 ` [PATCH v2] mm: support anonymous stable page Hugh Dickins
2016-11-22  4:43   ` Minchan Kim
2016-11-23  4:43     ` Hugh Dickins
2016-11-23  7:41       ` Minchan Kim

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20161120233015.GA14113@bbox \
    --to=minchan@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=cheol.lee@lge.com \
    --cc=darrick.wong@oracle.com \
    --cc=hughd@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=yjay.kim@lge.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).