Re: [PATCH] mm: Save soft-dirty bits on swapped pages

From: Andy Lutomirski
Date: Wed Jul 24 2013 - 13:42:49 EST

On Wed, Jul 24, 2013 at 10:36 AM, James Bottomley
<James.Bottomley@xxxxxxxxxxxxxxxxxxxxx> wrote:
> On Wed, 2013-07-24 at 21:17 +0400, Cyrill Gorcunov wrote:
>> On Wed, Jul 24, 2013 at 10:06:53AM -0700, Andy Lutomirski wrote:
>> > > Hi Andy, if I understand you correctly "file-backed pages" are carried
>> > > in pte with _PAGE_FILE bit set and the swap soft-dirty bit won't be
>> > > used on them but _PAGE_SOFT_DIRTY will be set on write if only I've
>> > > not missed something obvious (Pavel?).
>> >
>> > If I understand this stuff correctly, the vmscan code calls
>> > try_to_unmap when it reclaims memory, which makes its way into
>> > try_to_unmap_one, which clears the pte (and loses the soft-dirty bit).
>> Indeed, I was so stareing into swap that forgot about files. I'll do
>> a separate patch for that, thanks!
> Lets just be clear about the problem first: the vmscan pass referred to
> above happens only on clean pages, so the soft dirty bit could only be
> set if the page was previously dirty and got written back. Now it's an
> exercise for the reader whether we want to reinstantiate a cleaned
> evicted page for the purpose of doing an iterative migration or whether
> we want to flip the page in the migrated entity to be evicted (so if it
> gets referred to, it pulls in an up to date copy) ... assuming the
> backing file also gets transferred, of course.

I think I understand your distinction. Nonetheless, given the loss of
the soft-dirty bit, the migration tool could fail to notice that the
pages was dirtied and subsequently cleaned and evicted. I'm
unconvinced that doing this on a per-PTE basis is the right way,

I've long wanted a feature to efficiently see what changed on a
filesystem by comparing, say, a hash tree. NTFS can do this (sort
of), but I don't think that anything else can. I think that btrfs
should be able to, but there's no API that I've ever seen.

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at