linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Rik van Riel <riel@redhat.com>
To: Kelley Nielsen <kelleynnn@gmail.com>,
	linux-mm@kvack.org, riel@surriel.com,
	opw-kernel@googlegroups.com, hughd@google.com,
	akpm@linux-foundation.org, jamieliu@google.com,
	sjenning@linux.vnet.ibm.com, sarah.a.sharp@intel.com
Subject: Re: [RFC v6 2/2] mm: swapoff prototype: frontswap handling added
Date: Wed, 12 Nov 2014 17:10:32 -0500	[thread overview]
Message-ID: <5463DAD8.3050601@redhat.com> (raw)
In-Reply-To: <20141112025823.GA7464@kelleynnn-virtual-machine>

On 11/11/2014 09:58 PM, Kelley Nielsen wrote:
> The prototype of the new swapoff (without the quadratic complexity)
> presently ignores the frontswap case. Pass the count of
> pages_to_unuse down the page table walks in try_to_unuse(),
> and return from the walk when the desired number of pages
> has been swapped back in.
> 
> Signed-off-by: Kelley Nielsen <kelleynnn@gmail.com>
> ---
>  mm/shmem.c    |  1 +
>  mm/swapfile.c | 53 +++++++++++++++++++++++++++++++++++++----------------
>  2 files changed, 38 insertions(+), 16 deletions(-)
> 
> diff --git a/mm/shmem.c b/mm/shmem.c
> index 2a7179c..e7a813f 100644
> --- a/mm/shmem.c
> +++ b/mm/shmem.c
> @@ -629,6 +629,7 @@ static int shmem_unuse_inode(struct inode *inode, unsigned int type)
>  	int entries = 0;
>  	swp_entry_t entry;
>  	unsigned int stype;
> +
>  	pgoff_t start = 0;

Why is there an shmem.c blank line in the frontswap patch?

> @@ -1210,6 +1212,15 @@ static int unuse_pte_range(struct vm_area_struct *vma, pmd_t *pmd,
>  		SetPageDirty(page);
>  		unlock_page(page);
>  		page_cache_release(page);
> +		if (ret && pages_to_unuse > 0) {
> +			pages_to_unuse--;
> +			/*
> +			 * we've unused all we need for frontswap,
> +			 * so return special code to indicate this.
> +			 */
> +			if (pages_to_unuse == 0)
> +				return 2;
> +		}

If you are using a magic value, could you make it a #define so
people can more easily find out why the code is testing for == 2
elsewhere?

One obvious bug is that the pages_to_unuse variable is passed by
value, so try_to_unuse never sees that unuse_pte_range decremented
the counter. You will want to use a pointer instead.

A second issue is that you decrement pages_to_unuse on every pte
unmap, and not on every swap slot that is unused. Would it make
more sense to decrement pages_to_unuse where you call
delete_from_swap_cache?

Other than that, this series looks good to me.

--
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:[~2014-11-12 22:13 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-12  2:58 Kelley Nielsen
2014-11-12 22:10 ` Rik van Riel [this message]

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=5463DAD8.3050601@redhat.com \
    --to=riel@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=hughd@google.com \
    --cc=jamieliu@google.com \
    --cc=kelleynnn@gmail.com \
    --cc=linux-mm@kvack.org \
    --cc=opw-kernel@googlegroups.com \
    --cc=riel@surriel.com \
    --cc=sarah.a.sharp@intel.com \
    --cc=sjenning@linux.vnet.ibm.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