From patchwork Tue Aug 10 20:29:35 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yang Shi X-Patchwork-Id: 12429421 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=-13.5 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED,DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT 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 3E93BC432BE for ; Tue, 10 Aug 2021 20:29:44 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id CC011604AC for ; Tue, 10 Aug 2021 20:29:43 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org CC011604AC 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 53F006B0071; Tue, 10 Aug 2021 16:29:43 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4F0938D0003; Tue, 10 Aug 2021 16:29:43 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 38FCE6B0073; Tue, 10 Aug 2021 16:29:43 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0028.hostedemail.com [216.40.44.28]) by kanga.kvack.org (Postfix) with ESMTP id 1F7E66B0071 for ; Tue, 10 Aug 2021 16:29:43 -0400 (EDT) Received: from smtpin06.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id C9C071B667 for ; Tue, 10 Aug 2021 20:29:42 +0000 (UTC) X-FDA: 78460311804.06.0113285 Received: from mail-pl1-f171.google.com (mail-pl1-f171.google.com [209.85.214.171]) by imf04.hostedemail.com (Postfix) with ESMTP id 8DC2B5001B4E for ; Tue, 10 Aug 2021 20:29:42 +0000 (UTC) Received: by mail-pl1-f171.google.com with SMTP id d17so22889372plr.12 for ; Tue, 10 Aug 2021 13:29:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=g/pTJfigSCEh5kckZ70NaOFpwcYGnuFXZ4+14JoNPQc=; b=dgoxXGQqN4xU6YEPuThXK7v1DTae92iDRcALKgKvLO2p9wvXc8Gby6jXL9xrh8aXpl y+y77nHdKJy4yAOH1UFqMvuh4g9O+NHr4Ht99XWVyBt5f0fwwn6+hZ7jLPbljT3RgYhL tQUHdnnitxR33DRP87VLkRlI0Lp0a2N27Hmz199C9flOLfYc9sAMJpDKzpvthCaLI6ea NEjRwLAqOM76XT/HP8MwrM4IfhXwhfmGBR3b4wSo/RsLaZZDw/2cXUzy1webG25+GVTP 8i8tmmlJyoQh0tyB5xBMrZ/gKNn7dpb9uENpx9XDvjaq2UZsGy7jP9wBgwzI34kvqQ5a n4eg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=g/pTJfigSCEh5kckZ70NaOFpwcYGnuFXZ4+14JoNPQc=; b=XlhNN6doMSHUzGlB+iEfuw0cRE6V3wJe/hcraCtrusUDD5VsHzhBG+vLwNQtWlD5+2 TE2O9ZUmxY0w6tALtBMg+jR+a/4sxDzsVC9u8srbPd2ZVdlhnFTL9x6Rh9cf/UGCmeiQ yvZIjYU1whK4FbK9HVCJ6ggoEs5SjaqeIqIsm3r6n7LJbfpOTxqgcP3SNqzTi+nxgk1f LYnhL1oXsIzAWBo5tdSqQTx+Wtdr3wvYrqXM/bsR+Eo/aj87W4QWmdGkqWvhheNkGEJH aSg2Pmh8ypdiAcmZFAaNevZoOUJDJmjwq2wcKswnVyAySs9uw6roK6TSAAh3yoB9c3Pr Ty9g== X-Gm-Message-State: AOAM533qTj+ZEzNLKTlhJPrFTUcgqh5cHbq/BmLEvdspQquSsm+hdUWq ar4rY3Y1QD2QygBERPvehLM= X-Google-Smtp-Source: ABdhPJw3R1cjaI6hRD7+jh7X4bu72Tk12gIFPbsf9htD7SeLAXnKzFekOLSN1lT9i7SmvtzvLMUGlA== X-Received: by 2002:a62:87c5:0:b029:3b5:f90f:c2eb with SMTP id i188-20020a6287c50000b02903b5f90fc2ebmr31281252pfe.28.1628627381588; Tue, 10 Aug 2021 13:29:41 -0700 (PDT) Received: from localhost.localdomain (c-73-93-239-127.hsd1.ca.comcast.net. [73.93.239.127]) by smtp.gmail.com with ESMTPSA id e12sm24697145pfc.214.2021.08.10.13.29.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Aug 2021 13:29:40 -0700 (PDT) From: Yang Shi To: hughd@google.com, ying.huang@intel.com, linmiaohe@huawei.com, Andrew Morton Cc: shy828301@gmail.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/3] Revert "mm/shmem: fix shmem_swapin() race with swapoff" Date: Tue, 10 Aug 2021 13:29:35 -0700 Message-Id: <20210810202936.2672-2-shy828301@gmail.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210810202936.2672-1-shy828301@gmail.com> References: <20210810202936.2672-1-shy828301@gmail.com> MIME-Version: 1.0 X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 8DC2B5001B4E Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=gmail.com header.s=20161025 header.b=dgoxXGQq; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf04.hostedemail.com: domain of shy828301@gmail.com designates 209.85.214.171 as permitted sender) smtp.mailfrom=shy828301@gmail.com X-Stat-Signature: shucti4k7uqt8wqcwwmy8e49amt4g47g X-HE-Tag: 1628627382-170246 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: 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. 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; }