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=-3.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no 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 5047EC433ED for ; Wed, 14 Apr 2021 01:04:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2E5C1613B6 for ; Wed, 14 Apr 2021 01:04:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348945AbhDNBEe (ORCPT ); Tue, 13 Apr 2021 21:04:34 -0400 Received: from mga06.intel.com ([134.134.136.31]:46680 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343683AbhDNBEd (ORCPT ); Tue, 13 Apr 2021 21:04:33 -0400 IronPort-SDR: bNOwz/3bRiwly6FoCWtZWwISTG7iW0PNOLhym1YPMpmh9ZaQqhXf33TEYgp+6ETufxkccXJY15 //pjCGu8sqhg== X-IronPort-AV: E=McAfee;i="6200,9189,9953"; a="255855759" X-IronPort-AV: E=Sophos;i="5.82,220,1613462400"; d="scan'208";a="255855759" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Apr 2021 18:04:12 -0700 IronPort-SDR: d7U9oFOTWCLb+5LmgnBKRP2tjlMQBm+FQYsb54WaiIHq/+YczaLTHSv5IBteFo5kqaaqI3aPhg T8ofDXTE9IHA== X-IronPort-AV: E=Sophos;i="5.82,220,1613462400"; d="scan'208";a="424495027" Received: from yhuang6-desk1.sh.intel.com (HELO yhuang6-desk1.ccr.corp.intel.com) ([10.239.13.1]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Apr 2021 18:04:08 -0700 From: "Huang, Ying" To: Tim Chen Cc: Miaohe Lin , , , , , , , , , , , , Subject: Re: [PATCH 2/5] swap: fix do_swap_page() race with swapoff References: <20210408130820.48233-1-linmiaohe@huawei.com> <20210408130820.48233-3-linmiaohe@huawei.com> <87o8ejug76.fsf@yhuang6-desk1.ccr.corp.intel.com> Date: Wed, 14 Apr 2021 09:04:05 +0800 In-Reply-To: (Tim Chen's message of "Tue, 13 Apr 2021 12:24:15 -0700") Message-ID: <878s5lu16i.fsf@yhuang6-desk1.ccr.corp.intel.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=ascii Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Tim Chen writes: > On 4/12/21 6:27 PM, Huang, Ying wrote: > >> >> This isn't the commit that introduces the race. You can use `git blame` >> find out the correct commit. For this it's commit 0bcac06f27d7 "mm, >> swap: skip swapcache for swapin of synchronous device". >> >> And I suggest to merge 1/5 and 2/5 to make it easy to get the full >> picture. > > I'll suggest make fix to do_swap_page race with get/put_swap_device > as a first patch. Then the per_cpu_ref stuff in patch 1 and patch 2 can > be combined together. The original get/put_swap_device() use rcu_read_lock/unlock(). I don't think it's good to wrap swap_read_page() with it. After all, some complex operations are done in swap_read_page(), including blk_io_schedule(). Best Regards, Huang, Ying 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=-3.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no 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 360DBC433B4 for ; Wed, 14 Apr 2021 01:04:17 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 9E4E7613BD for ; Wed, 14 Apr 2021 01:04:16 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9E4E7613BD Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id B301D6B0036; Tue, 13 Apr 2021 21:04:15 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id AE25A6B006C; Tue, 13 Apr 2021 21:04:15 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 980516B0070; Tue, 13 Apr 2021 21:04:15 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0019.hostedemail.com [216.40.44.19]) by kanga.kvack.org (Postfix) with ESMTP id 7F78C6B0036 for ; Tue, 13 Apr 2021 21:04:15 -0400 (EDT) Received: from smtpin35.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 34A824015FF4 for ; Wed, 14 Apr 2021 01:04:15 +0000 (UTC) X-FDA: 78029176470.35.03B1AC1 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by imf13.hostedemail.com (Postfix) with ESMTP id 4E4D8E000114 for ; Wed, 14 Apr 2021 01:04:11 +0000 (UTC) IronPort-SDR: nlTz/LiDQ3PbZC18EnqWq0g8Xtcuc0T9a53qS37jp0D6IWFHVmWFxR9AF6mHQEA26Z8Hld80lS icmDLwc8OF5g== X-IronPort-AV: E=McAfee;i="6200,9189,9953"; a="279849296" X-IronPort-AV: E=Sophos;i="5.82,220,1613462400"; d="scan'208";a="279849296" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Apr 2021 18:04:12 -0700 IronPort-SDR: d7U9oFOTWCLb+5LmgnBKRP2tjlMQBm+FQYsb54WaiIHq/+YczaLTHSv5IBteFo5kqaaqI3aPhg T8ofDXTE9IHA== X-IronPort-AV: E=Sophos;i="5.82,220,1613462400"; d="scan'208";a="424495027" Received: from yhuang6-desk1.sh.intel.com (HELO yhuang6-desk1.ccr.corp.intel.com) ([10.239.13.1]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Apr 2021 18:04:08 -0700 From: "Huang, Ying" To: Tim Chen Cc: Miaohe Lin , , , , , , , , , , , , Subject: Re: [PATCH 2/5] swap: fix do_swap_page() race with swapoff References: <20210408130820.48233-1-linmiaohe@huawei.com> <20210408130820.48233-3-linmiaohe@huawei.com> <87o8ejug76.fsf@yhuang6-desk1.ccr.corp.intel.com> Date: Wed, 14 Apr 2021 09:04:05 +0800 In-Reply-To: (Tim Chen's message of "Tue, 13 Apr 2021 12:24:15 -0700") Message-ID: <878s5lu16i.fsf@yhuang6-desk1.ccr.corp.intel.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=ascii X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 4E4D8E000114 X-Stat-Signature: 9jbu4wu7uen6kw48b9rddre6r7dydg5a Received-SPF: none (intel.com>: No applicable sender policy available) receiver=imf13; identity=mailfrom; envelope-from=""; helo=mga05.intel.com; client-ip=192.55.52.43 X-HE-DKIM-Result: none/none X-HE-Tag: 1618362251-915113 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: Tim Chen writes: > On 4/12/21 6:27 PM, Huang, Ying wrote: > >> >> This isn't the commit that introduces the race. You can use `git blame` >> find out the correct commit. For this it's commit 0bcac06f27d7 "mm, >> swap: skip swapcache for swapin of synchronous device". >> >> And I suggest to merge 1/5 and 2/5 to make it easy to get the full >> picture. > > I'll suggest make fix to do_swap_page race with get/put_swap_device > as a first patch. Then the per_cpu_ref stuff in patch 1 and patch 2 can > be combined together. The original get/put_swap_device() use rcu_read_lock/unlock(). I don't think it's good to wrap swap_read_page() with it. After all, some complex operations are done in swap_read_page(), including blk_io_schedule(). Best Regards, Huang, Ying