All of lore.kernel.org
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: "Huang, Ying" <ying.huang@intel.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Hugh Dickins <hughd@google.com>,
	David Hildenbrand <david@redhat.com>,
	Yang Shi <shy828301@gmail.com>, Linux-MM <linux-mm@kvack.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Miaohe Lin <linmiaohe@huawei.com>,
	Johannes Weiner <hannes@cmpxchg.org>,
	Michal Hocko <mhocko@suse.com>,
	Joonsoo Kim <iamjoonsoo.kim@lge.com>,
	Minchan Kim <minchan@kernel.org>,
	huang ying <huang.ying.caritas@gmail.com>
Subject: Re: [PATCH] mm,shmem: Fix a typo in shmem_swapin_page()
Date: Tue, 3 Aug 2021 12:59:10 +0100	[thread overview]
Message-ID: <YQkvjng6ljwtp9eb@casper.infradead.org> (raw)
In-Reply-To: <877dh354vc.fsf@yhuang6-desk2.ccr.corp.intel.com>

On Tue, Aug 03, 2021 at 04:06:47PM +0800, Huang, Ying wrote:
> As Hugh pointed out, EINVAL isn't an appropriate error code for race
> condition.  After checking the code, I found that EEXIST is the error
> code used for race condition.  So I revise the patch as below.  If Hugh
> doesn't object, can you help to replace the patch with the below one?
> 
> Best Regards,
> Huang, Ying
> 
> -----------------------------8<---------------------------------------
> >From e2b281a0b09d34d6463942e214e577ed9357c213 Mon Sep 17 00:00:00 2001
> From: Huang Ying <ying.huang@intel.com>
> Date: Tue, 3 Aug 2021 10:51:16 +0800
> Subject: [PATCH] shmem_swapin_page(): fix error processing for
>  get_swap_device()
> 
> Firstly, "-" is missing before the error code.  Secondly, EINVAL isn't
> the proper error code for the race condition.  EEXIST is used in
> shmem_swapin_page() for that.  So the error code is changed to EEXIST
> too.
> 
> Link: https://lkml.kernel.org/r/20210723080000.93953-1-ying.huang@intel.com
> Fixes: 2efa33fc7f6e ("mm/shmem: fix shmem_swapin() race with swapoff")
> Signed-off-by: "Huang, Ying" <ying.huang@intel.com>

Suggested-by: Matthew Wilcox (Oracle) <willy@infradead.org>

Also, the description is poor.  How about:

If we hit this rare race, returning EINVAL (or even -EINVAL) would cause
the page fault to be handled as a SIGBUS.  This is not correct; the page
is not missing or unreadable, it has simply changed location.  Returning
-EEXIST here will cause the lookup to be retried by the caller.


  reply	other threads:[~2021-08-03 12:00 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-23  8:00 [PATCH] mm,shmem: Fix a typo in shmem_swapin_page() Huang Ying
2021-07-23 11:10 ` David Hildenbrand
2021-07-23 20:23 ` Hugh Dickins
2021-07-23 20:23   ` Hugh Dickins
2021-07-23 21:53   ` Matthew Wilcox
2021-08-03  8:14     ` Huang, Ying
2021-08-03  8:14       ` Huang, Ying
2021-08-03 12:01       ` Matthew Wilcox
2021-08-04  5:34         ` Hugh Dickins
2021-08-04  5:34           ` Hugh Dickins
2021-08-04  9:04           ` Huang, Ying
2021-08-04  9:04             ` Huang, Ying
2021-08-05 23:08           ` Yang Shi
2021-08-05 23:08             ` Yang Shi
2021-08-06  6:01             ` Hugh Dickins
2021-08-06  6:01               ` Hugh Dickins
2021-08-06 20:37               ` Yang Shi
2021-08-06 20:37                 ` Yang Shi
2021-08-09 21:26                 ` Yang Shi
2021-08-09 21:26                   ` Yang Shi
2021-08-09 23:43                   ` Huang, Ying
2021-08-09 23:43                     ` Huang, Ying
2021-08-10  1:11                     ` Yang Shi
2021-08-10  1:11                       ` Yang Shi
2021-08-04  9:01         ` Huang, Ying
2021-08-04  9:01           ` Huang, Ying
2021-07-28 13:03   ` huang ying
2021-07-28 13:03     ` huang ying
2021-08-03  8:06     ` Huang, Ying
2021-08-03  8:06       ` Huang, Ying
2021-08-03 11:59       ` Matthew Wilcox [this message]
2021-08-04  4:28       ` Hugh Dickins
2021-08-04  4:28         ` Hugh Dickins
2021-08-04  6:42     ` Hugh Dickins
2021-08-04  6:42       ` Hugh Dickins
2021-08-04  8:59       ` Huang, Ying
2021-08-04  8:59         ` Huang, Ying

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=YQkvjng6ljwtp9eb@casper.infradead.org \
    --to=willy@infradead.org \
    --cc=akpm@linux-foundation.org \
    --cc=david@redhat.com \
    --cc=hannes@cmpxchg.org \
    --cc=huang.ying.caritas@gmail.com \
    --cc=hughd@google.com \
    --cc=iamjoonsoo.kim@lge.com \
    --cc=linmiaohe@huawei.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@suse.com \
    --cc=minchan@kernel.org \
    --cc=shy828301@gmail.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.