linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: William Kucharski <william.kucharski@oracle.com>
To: Huang Ying <ying.huang@intel.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	Vineeth Remanan Pillai <vpillai@digitalocean.com>,
	Kelley Nielsen <kelleynnn@gmail.com>,
	Rik van Riel <riel@surriel.com>,
	Matthew Wilcox <willy@infradead.org>,
	Hugh Dickins <hughd@google.com>
Subject: Re: [PATCH 2/2] swap: Deal with PTE mapped THP when unuse PTE
Date: Tue, 11 Dec 2018 07:32:07 -0700	[thread overview]
Message-ID: <77D903B4-E63F-4633-8D5B-C39EFC067FB8@oracle.com> (raw)
In-Reply-To: <20181211084609.19553-2-ying.huang@intel.com>



> ---
> mm/swapfile.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/mm/swapfile.c b/mm/swapfile.c
> index 7464d0a92869..9e6da494781f 100644
> --- a/mm/swapfile.c
> +++ b/mm/swapfile.c
> @@ -1921,10 +1921,8 @@ static int unuse_pte_range(struct vm_area_struct *vma, pmd_t *pmd,
> 			goto out;
> 		}
> 
> -		if (PageSwapCache(page) && (swap_count(*swap_map) == 0))
> -			delete_from_swap_cache(compound_head(page));
> +		try_to_free_swap(page);
> 
> -		SetPageDirty(page);
> 		unlock_page(page);
> 		put_page(page);
> 
> -- 
> 2.18.1
> 

Since try_to_free_swap() can return 0 under certain error conditions, you should check
check for a return status of 1 before calling unlock_page() and put_page().

Reviewed-by: William Kucharski <william.kucharski@oracle.com>

      reply	other threads:[~2018-12-11 14:32 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-11  8:46 [PATCH 1/2] swap: Fix general protection fault when swapoff Huang Ying
2018-12-11  8:46 ` [PATCH 2/2] swap: Deal with PTE mapped THP when unuse PTE Huang Ying
2018-12-11 14:32   ` William Kucharski [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=77D903B4-E63F-4633-8D5B-C39EFC067FB8@oracle.com \
    --to=william.kucharski@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=hughd@google.com \
    --cc=kelleynnn@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=riel@surriel.com \
    --cc=vpillai@digitalocean.com \
    --cc=willy@infradead.org \
    --cc=ying.huang@intel.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).