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=-12.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham 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 69D19C4338F for ; Tue, 10 Aug 2021 23:15:04 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id C6E0660EE9 for ; Tue, 10 Aug 2021 23:15:03 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org C6E0660EE9 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 1E1BD8D0001; Tue, 10 Aug 2021 19:15:03 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 16BDC6B0072; Tue, 10 Aug 2021 19:15:03 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 032618D0001; Tue, 10 Aug 2021 19:15:02 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0214.hostedemail.com [216.40.44.214]) by kanga.kvack.org (Postfix) with ESMTP id D96296B0071 for ; Tue, 10 Aug 2021 19:15:02 -0400 (EDT) Received: from smtpin22.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 65AAD22BF1 for ; Tue, 10 Aug 2021 23:15:02 +0000 (UTC) X-FDA: 78460728444.22.36B2C9A Received: from mail-ed1-f43.google.com (mail-ed1-f43.google.com [209.85.208.43]) by imf22.hostedemail.com (Postfix) with ESMTP id 262794F9B for ; Tue, 10 Aug 2021 23:15:02 +0000 (UTC) Received: by mail-ed1-f43.google.com with SMTP id by4so692761edb.0 for ; Tue, 10 Aug 2021 16:15:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=GUPlvlIHsVV1HyaB0WHrhJqrkm62V56QQdb99OyYrME=; b=d548327fMFrF4HElne/pg8ZqB2axWgruQV3eF98nujz9NYnC+r6K/uE8dl1ll2yvWU HrL6VLhRBFsZIiJeWHg/92oQjvsa9voWfSaUIv3v2mzWjTyTGxRyC49zS0Blaetkpewe HsPYSFAbQSosuutny2je80yTuPqRd+C+UVW2+PqGEzK+Eib6MQ+pSSmryahjRVE28uYD WsG6XiVsRbzOZZmePrjTgsRpum3tpLHurlDCpKtJmjMeoUYWNTyAe+ZMbn5ebWxpoFDO jubdfL3e546ZAAc7dKRZfcTZa9RQoPuvM0T6HGhJjYFCaMd3iHCBzcYjgLO/1r/X7IVi gR9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=GUPlvlIHsVV1HyaB0WHrhJqrkm62V56QQdb99OyYrME=; b=sc9Ae8L4wW7ScCFfRP9rr1A6ZSkeKbIpf9XgrKUtpVNcSPH7PHYYANvbq5/IVbFqGV O61a5EJTgCgQALXsmVSRvDVWNLF0FrNOsKgCyuXIs0uRFK9xHxNibvxTp2yqjytjQgxA Jmc67sJpxUA7uoz7XHK47MGhW8nHb8omOm0hF89dEqBqXJw1a6yI9Nlekmdy6vxtjTi6 k5F2vIs8ihe9hynTo18ooojgMqtTm2f/uYyKxcV7zO3AuwPuxXKrj/5i1RTOSfrDIbGl 6F3AP3jXijnNWS8AXTevJrKB0FHLn2E+h6aBKtl0syvMuQnWYtF9XbRMa+d97wzafSvZ I4Mg== X-Gm-Message-State: AOAM5318ShlWAD4EbOU3porNdNztCFKnKFHqD00XpUz3LRJL/AAFztt8 xSU4BBbdWNrLZWPmK9dPgbBIXKqnBhdebQMgtdU= X-Google-Smtp-Source: ABdhPJxxoE6GGiwyiU+8OQ6VLJJz2j17ieL2oT4PyQDdF9V5sGkUgy9f2f+bfNF3WYpY+hQCVYSrZHyvGX/gHpWsRDg= X-Received: by 2002:a50:954c:: with SMTP id v12mr7793777eda.313.1628637300909; Tue, 10 Aug 2021 16:15:00 -0700 (PDT) MIME-Version: 1.0 References: <20210810202936.2672-1-shy828301@gmail.com> <20210810202936.2672-2-shy828301@gmail.com> In-Reply-To: <20210810202936.2672-2-shy828301@gmail.com> From: Yang Shi Date: Tue, 10 Aug 2021 16:14:49 -0700 Message-ID: Subject: Re: [PATCH 2/3] Revert "mm/shmem: fix shmem_swapin() race with swapoff" To: Hugh Dickins , Huang Ying , Miaohe Lin , Andrew Morton Cc: Linux MM , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 262794F9B Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=gmail.com header.s=20161025 header.b=d548327f; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf22.hostedemail.com: domain of shy828301@gmail.com designates 209.85.208.43 as permitted sender) smtp.mailfrom=shy828301@gmail.com X-Stat-Signature: 8e1ryw1bp8tbzmfrqdexuzy7arqy4dem X-HE-Tag: 1628637302-290312 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 10, 2021 at 1:29 PM Yang Shi wrote: > > Due to the change about how block layer detects congestion the > justification of commit 8fd2e0b505d1 ("mm: swap: check if swap backing device > is congested or not") doesn't stand anymore, so the commit could be just > reverted in order to solve the race reported by commit 2efa33fc7f6e ("mm/shmem: > fix shmem_swapin() race with swapoff"), so the fix commit could be just > reverted as well. The updated commit log per the discussion with Hugh: Due to the change about how block layer detects congestion the justification of commit 8fd2e0b505d1 ("mm: swap: check if swap backing device is congested or not") doesn't stand anymore, so the commit could be just reverted in order to solve the race reported by commit 2efa33fc7f6e ("mm/shmem: fix shmem_swapin() race with swapoff"), so the fix commit could be just reverted as well. And that fix is also kind of buggy as discussed by [1] and [2]. [1] https://lore.kernel.org/linux-mm/24187e5e-069-9f3f-cefe-39ac70783753@google.com/ [2] https://lore.kernel.org/linux-mm/e82380b9-3ad4-4a52-be50-6d45c7f2b5da@google.com/ > > Suggested-by: Hugh Dickins > Cc: "Huang, Ying" > Cc: Miaohe Lin > Signed-off-by: Yang Shi > --- > mm/shmem.c | 14 +------------- > 1 file changed, 1 insertion(+), 13 deletions(-) > > diff --git a/mm/shmem.c b/mm/shmem.c > index dcc07d14162e..d5427de5bf02 100644 > --- a/mm/shmem.c > +++ b/mm/shmem.c > @@ -1699,8 +1699,7 @@ static int shmem_swapin_page(struct inode *inode, pgoff_t index, > struct address_space *mapping = inode->i_mapping; > struct shmem_inode_info *info = SHMEM_I(inode); > struct mm_struct *charge_mm = vma ? vma->vm_mm : NULL; > - struct swap_info_struct *si; > - struct page *page = NULL; > + struct page *page; > swp_entry_t swap; > int error; > > @@ -1708,12 +1707,6 @@ static int shmem_swapin_page(struct inode *inode, pgoff_t index, > swap = radix_to_swp_entry(*pagep); > *pagep = NULL; > > - /* Prevent swapoff from happening to us. */ > - si = get_swap_device(swap); > - if (!si) { > - error = EINVAL; > - goto failed; > - } > /* Look it up and read it in.. */ > page = lookup_swap_cache(swap, NULL, 0); > if (!page) { > @@ -1775,8 +1768,6 @@ static int shmem_swapin_page(struct inode *inode, pgoff_t index, > swap_free(swap); > > *pagep = page; > - if (si) > - put_swap_device(si); > return 0; > failed: > if (!shmem_confirm_swap(mapping, index, swap)) > @@ -1787,9 +1778,6 @@ static int shmem_swapin_page(struct inode *inode, pgoff_t index, > put_page(page); > } > > - if (si) > - put_swap_device(si); > - > return error; > } > > -- > 2.26.2 >