From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7BE79C4320A for ; Tue, 3 Aug 2021 12:00:50 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id C9C4760F11 for ; Tue, 3 Aug 2021 12:00:49 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org C9C4760F11 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 2218D6B0033; Tue, 3 Aug 2021 08:00:49 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1D21D8D0001; Tue, 3 Aug 2021 08:00:49 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0C0C46B005D; Tue, 3 Aug 2021 08:00:49 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0106.hostedemail.com [216.40.44.106]) by kanga.kvack.org (Postfix) with ESMTP id E33676B0033 for ; Tue, 3 Aug 2021 08:00:48 -0400 (EDT) Received: from smtpin27.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 967EE2286B for ; Tue, 3 Aug 2021 12:00:48 +0000 (UTC) X-FDA: 78433627776.27.B73FC44 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf06.hostedemail.com (Postfix) with ESMTP id 04D72801E4E0 for ; Tue, 3 Aug 2021 12:00:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=mWWcG5RvzZnZtzlTEpwyxElez8u4/J5+F8NGP5+ob2I=; b=HrXnZbf8ZK+Qr50SSMhpEZCtgU l0YFFCxnK++awS8wJVr5m49RsENKHlMUb5wHA6U/ljSvInTXQabW2yyEp7b5/2XlgTBKSS6frG03k evTCgGgRDnmjsR4++F8tjEEPEYWdG5WYpldllArWVwMyoGKNaFl8lnUQ9iHqOFBJ8+xa3rMs5x4HK w5gozJoYw9BKU2ha1loKSuDyyRrzs2+gtE2maPM9rJ9jpYkFNII7Rmp8y7nSH081PCMOTnAOOrCkK ZJNLBDpgumgWyD+bBdPiwt38iDoLU94Pc19NDF7M2892jtQja3pfewd0l/IQzjk+m2x83pHawSeCf nQEXC+0Q==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1mAt4g-004bvm-21; Tue, 03 Aug 2021 11:59:17 +0000 Date: Tue, 3 Aug 2021 12:59:10 +0100 From: Matthew Wilcox To: "Huang, Ying" Cc: Andrew Morton , Hugh Dickins , David Hildenbrand , Yang Shi , Linux-MM , LKML , Miaohe Lin , Johannes Weiner , Michal Hocko , Joonsoo Kim , Minchan Kim , huang ying Subject: Re: [PATCH] mm,shmem: Fix a typo in shmem_swapin_page() Message-ID: References: <20210723080000.93953-1-ying.huang@intel.com> <24187e5e-069-9f3f-cefe-39ac70783753@google.com> <877dh354vc.fsf@yhuang6-desk2.ccr.corp.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <877dh354vc.fsf@yhuang6-desk2.ccr.corp.intel.com> X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 04D72801E4E0 Authentication-Results: imf06.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=HrXnZbf8; dmarc=none; spf=none (imf06.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org X-Stat-Signature: zn8i631mwx99j7ujr73uwnk4ny76y8nr X-HE-Tag: 1627992047-486619 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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 > 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" Suggested-by: Matthew Wilcox (Oracle) 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.