linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC patch] vm: clear swap entry before copying pte
@ 2012-07-27 13:53 Hillf Danton
  2012-07-31  2:34 ` Hugh Dickins
  0 siblings, 1 reply; 3+ messages in thread
From: Hillf Danton @ 2012-07-27 13:53 UTC (permalink / raw)
  To: Hugh Dickins; +Cc: KOSAKI Motohiro, Mel Gorman, Andrew Morton, LKML, Linux-MM

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.

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

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

* Re: [RFC patch] vm: clear swap entry before copying pte
  2012-07-27 13:53 [RFC patch] vm: clear swap entry before copying pte Hillf Danton
@ 2012-07-31  2:34 ` Hugh Dickins
  2012-07-31 12:32   ` Hillf Danton
  0 siblings, 1 reply; 3+ messages in thread
From: Hugh Dickins @ 2012-07-31  2:34 UTC (permalink / raw)
  To: Hillf Danton; +Cc: KOSAKI Motohiro, Mel Gorman, Andrew Morton, LKML, Linux-MM

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

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

* Re: [RFC patch] vm: clear swap entry before copying pte
  2012-07-31  2:34 ` Hugh Dickins
@ 2012-07-31 12:32   ` Hillf Danton
  0 siblings, 0 replies; 3+ messages in thread
From: Hillf Danton @ 2012-07-31 12:32 UTC (permalink / raw)
  To: Hugh Dickins; +Cc: KOSAKI Motohiro, Mel Gorman, Andrew Morton, LKML, Linux-MM

Hi Hugh,

On Tue, Jul 31, 2012 at 10:34 AM, Hugh Dickins <hughd@google.com> wrote:
> 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.


I just want to avoid allocating page in add_swap_count_continuation()
for non clear reason, as you see, which is not a bug fix.

Thanks,
		Hillf

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

end of thread, other threads:[~2012-07-31 12:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-27 13:53 [RFC patch] vm: clear swap entry before copying pte Hillf Danton
2012-07-31  2:34 ` Hugh Dickins
2012-07-31 12:32   ` Hillf Danton

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