linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Hugh Dickins <hughd@google.com>
To: Hillf Danton <dhillf@gmail.com>
Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>,
	Mel Gorman <mgorman@suse.de>,
	Andrew Morton <akpm@linux-foundation.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Linux-MM <linux-mm@kvack.org>
Subject: Re: [RFC patch] vm: clear swap entry before copying pte
Date: Mon, 30 Jul 2012 19:34:10 -0700 (PDT)	[thread overview]
Message-ID: <alpine.LSU.2.00.1207301907010.3953@eggly.anvils> (raw)
In-Reply-To: <CAJd=RBDQ1J9UTWOK1x6XNYunFz36RsMnr1Om9HsQQ_Kp8P7RKQ@mail.gmail.com>

On Fri, 27 Jul 2012, Hillf Danton wrote:
> 
> If swap entry is cleared, we can see the reason that copying pte is
> interrupted. If due to page table lock held long enough, no need to
> increase swap count.

I can't see a bug to be fixed here.

How would it break out of the loop above without freshly setting entry
(given that mmap_sem is held with down_write, so the entries cannot be
munmap'ped by another thread)?  How would it matter if it could (given
that add_swap_count_continuation already allows for races; and if there
were a problem, the call just made could be equally at fault)?

Nor do I understand your description.

But I can see that the lack of reinitialization of entry.val here
does raise doubt and confusion.  A better tidyup would be to remove
the initialization of swp_entry_t entry from its onstack declaration,
and do it at the again label instead.

If you send a patch to do that instead, I could probably ack it -
but expect I shall want to change your description.

Hugh

> 
> Signed-off-by: Hillf Danton <dhillf@gmail.com>
> ---
> 
> --- a/mm/memory.c	Fri Jul 27 21:33:32 2012
> +++ b/mm/memory.c	Fri Jul 27 21:35:24 2012
> @@ -971,6 +971,7 @@ again:
>  		if (add_swap_count_continuation(entry, GFP_KERNEL) < 0)
>  			return -ENOMEM;
>  		progress = 0;
> +		entry.val = 0;
>  	}
>  	if (addr != end)
>  		goto again;
> --

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2012-07-31  2:35 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-27 13:53 Hillf Danton
2012-07-31  2:34 ` Hugh Dickins [this message]
2012-07-31 12:32   ` Hillf Danton

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=alpine.LSU.2.00.1207301907010.3953@eggly.anvils \
    --to=hughd@google.com \
    --cc=akpm@linux-foundation.org \
    --cc=dhillf@gmail.com \
    --cc=kosaki.motohiro@jp.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mgorman@suse.de \
    /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