Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp3375109pxb; Wed, 14 Apr 2021 04:11:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxO3ZafbWkVEhjg/PcrrF1mjrno9cI8orkj9xn7ORcgWK8a2GY7nT7GkDIaKHDQDg9SeTqt X-Received: by 2002:a17:907:94ca:: with SMTP id dn10mr8963952ejc.123.1618398684896; Wed, 14 Apr 2021 04:11:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618398684; cv=none; d=google.com; s=arc-20160816; b=IOxkUr/LiblBtEy5nQ8UBBjae2j/Am4OvVKJ0+BTvNZuwlsG6rHnyQgweGB5OTCNc4 eFTBtGWWuD0u0AprMEs19GM7FMKB44Pa7dtUeOJ0O/N4/gvygDfqebxHfRsi//mpN4GY EHMjB6600GEvb9nSEHwRa1G18WObmw2OuMZjGtY85BeSMaAOlW8IDgV9Cqv6q607TO8E OO6q7TIK6mMltEep0JG2gmZIcZSiQLJSJvnE180IFUAaVP4tKHv100uyRsBtU6fZYPiF 8ve9l5rFcztxFv4mzd8xM9auxPQ/yILu/B0q4FCwUTcUN3ySMvA0wjbXNc38ckwHihaf 1yeg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:message-id:in-reply-to :date:references:subject:cc:to:from:ironport-sdr:ironport-sdr; bh=B4PaqOFhr84WF1SdCXTDEQc8LZTCIOT7D3R35gDLdak=; b=nHHudSoi3sn+cZJUjS050aOyuWQEgntEkwm5tgFMiHjFa3iiEOEv1KZ/MeDHZEOf97 697VSPT0N2+6JgpRs/d0gHfkLxfV6X+K0NYAfp5p9pEx7cQU2/RrEhQeDaq3DDNGQKWI JfTKPOlOgfWBjblQr8plOBr/099Zb/iyLYRNhUm5R9CzJKUnMTTJfTYQO66SjpIrkZWO j6gCEIJqJ2dQVc2I644YCq+bgiJhloQRzppd96hotEyKwkJH8xDkJ4FgzdHmqGPSfUNX 8phiejogifK7S/U/HrM3BcF7ZBR8X3v389bIMjl7SeQGGVGsIk9lANZMUDL22pQwCssB PwGw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q2si12451770ejz.47.2021.04.14.04.11.00; Wed, 14 Apr 2021 04:11:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348941AbhDNBEd (ORCPT + 99 others); Tue, 13 Apr 2021 21:04:33 -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