Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp528723pxf; Thu, 8 Apr 2021 07:59:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwpGD2OpW8ih/EZTJw4/wPMldJ6/dYpjo4Gx2ieRABRWU5jrqAPJXgdq5EcEPf/Fu6g1hPC X-Received: by 2002:a17:902:47:b029:e9:2b01:1a66 with SMTP id 65-20020a1709020047b02900e92b011a66mr8293668pla.7.1617893952472; Thu, 08 Apr 2021 07:59:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617893952; cv=none; d=google.com; s=arc-20160816; b=1LY+ghfUXOV85BDpaSPiL8hHgB1Y2aoUnimWd1CColimct8rvxLdn2p/t91HtaG+fh sXkXNuC+E01/l/LVGAu0zyVfIhnvVVk/uPHskCSecr8ga6p+TTaw3xEZhyvJOaI3Ikrq SYQxoVYoaCcAXbVDPHWWA/dyv+upBN1H9pS9Tbyomgs4S6/DlR08dI257cqsum1dKYRr FYigU5oI9ax9X6QcJYMDuxzTRtC6FhPAZNhkzkFV5CnDz2oo8UdKg1kkckYkkaFU/MEE y2dZXTlUMYHiDnFP3qRwJDVHIZ6lwZI3n9ePzZ4O+iPEsX4iW4eBBV6DPIWIo8J1ktIs XscA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:in-reply-to:content-disposition :references:message-id:subject:cc:to:from:date:dkim-signature; bh=/zh21pqJzqg68Qk5Jdx/atCUW7Qt9NnkRuCC5o2j3xs=; b=fodAneL05nS73QgkOXVA5blzwrgLoA7WRit5nUuUKQ9VoEy4C5UXR7IVznwIX0ZEy9 wVt9WnY70nSqh1oPrKn4DeVe8SKM62YoikGFE00XX/lCVd5pRCIVtygGEe+gumfVx68t vP7yRy18DwLYdoMCrs4YYbE3LcL3HXpkIIVzk1trTYuCIYm4ObsqTAzgwPTLZ/YFqozT N8SSrlGMacHgfVUB3rROR9SJrZGtnW3dRctjiD6/l+zSVCyaMpXdAayfY5jkgxKOYYGu Pl2FAyboYQ/ZCf+vmLgh7QkSF1xee4uf6D/jPlHgkvDJQgaPUVezoCCgLPY/zBg3GKqx JoCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=joteoyNC; 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=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u2si28682747plh.174.2021.04.08.07.59.00; Thu, 08 Apr 2021 07:59:12 -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; dkim=pass header.i=@ibm.com header.s=pp1 header.b=joteoyNC; 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=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232032AbhDHO5G (ORCPT + 99 others); Thu, 8 Apr 2021 10:57:06 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:12792 "EHLO mx0b-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231679AbhDHO5F (ORCPT ); Thu, 8 Apr 2021 10:57:05 -0400 Received: from pps.filterd (m0127361.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 138EtpHQ112362; Thu, 8 Apr 2021 10:56:16 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=date : from : to : cc : subject : message-id : references : content-type : in-reply-to : mime-version; s=pp1; bh=/zh21pqJzqg68Qk5Jdx/atCUW7Qt9NnkRuCC5o2j3xs=; b=joteoyNCX5ogdYnNZV4j661oSPb2snooGjNcfIbRI3EOXAKHlZrlI+32QBTPg3wuhka3 0mOWm7iI5mXRTQHCLse8zt1UD/pyFdyFGw8bOIvhlascQ4YuWTRMaaaCwwqCyoxqql3D xxtJMI6Pcr+4O/78Bv5Fdh/C1ZGcV1HDfjykdOpE0C9j0n3eXkXbcn/Du4Gn5wZhRv30 Mc50CdRXBwAPtrqnoZBV31D9jlSDnY0ZBF2a2qBdvU7b2waY0SM0Ym+guy/3FbPj5Qne Jk0M/rZAL3CoLLAPScxn1E4nrRvznf0fLopJArBhTcLvZ+HPHDLSt4efu6n5IZUlMnur 9w== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 37rvmgmq47-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 08 Apr 2021 10:56:15 -0400 Received: from m0127361.ppops.net (m0127361.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 138Eu84o113636; Thu, 8 Apr 2021 10:56:08 -0400 Received: from ppma04fra.de.ibm.com (6a.4a.5195.ip4.static.sl-reverse.com [149.81.74.106]) by mx0a-001b2d01.pphosted.com with ESMTP id 37rvmgmpkt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 08 Apr 2021 10:56:08 -0400 Received: from pps.filterd (ppma04fra.de.ibm.com [127.0.0.1]) by ppma04fra.de.ibm.com (8.16.0.43/8.16.0.43) with SMTP id 138EgVpo010511; Thu, 8 Apr 2021 14:55:20 GMT Received: from b06cxnps4075.portsmouth.uk.ibm.com (d06relay12.portsmouth.uk.ibm.com [9.149.109.197]) by ppma04fra.de.ibm.com with ESMTP id 37rvc5gw93-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 08 Apr 2021 14:55:20 +0000 Received: from d06av24.portsmouth.uk.ibm.com (d06av24.portsmouth.uk.ibm.com [9.149.105.60]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 138EtIhQ57606526 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 8 Apr 2021 14:55:18 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4CD3542042; Thu, 8 Apr 2021 14:55:18 +0000 (GMT) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E681442045; Thu, 8 Apr 2021 14:55:17 +0000 (GMT) Received: from localhost (unknown [9.85.70.102]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 8 Apr 2021 14:55:17 +0000 (GMT) Date: Thu, 8 Apr 2021 20:25:17 +0530 From: riteshh To: Miaohe Lin Cc: akpm@linux-foundation.org, hannes@cmpxchg.org, mhocko@suse.com, iamjoonsoo.kim@lge.com, vbabka@suse.cz, alex.shi@linux.alibaba.com, willy@infradead.org, minchan@kernel.org, richard.weiyang@gmail.com, ying.huang@intel.com, hughd@google.com, tim.c.chen@linux.intel.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH 0/5] close various race windows for swap Message-ID: <20210408145517.jqodfz6cmm4wwk7g@riteshh-domain> References: <20210408130820.48233-1-linmiaohe@huawei.com> Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210408130820.48233-1-linmiaohe@huawei.com> X-TM-AS-GCONF: 00 X-Proofpoint-GUID: AUM94jp9j7OwTyd4YdJfeM5VnUtO03bb X-Proofpoint-ORIG-GUID: DRV0DWS22U1rM_oJc_MQdIWorN1hloc- X-Proofpoint-UnRewURL: 0 URL was un-rewritten MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391,18.0.761 definitions=2021-04-08_03:2021-04-08,2021-04-08 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 lowpriorityscore=0 spamscore=0 impostorscore=0 mlxscore=0 adultscore=0 phishscore=0 priorityscore=1501 malwarescore=0 clxscore=1011 mlxlogscore=999 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104060000 definitions=main-2104080102 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 21/04/08 09:08AM, Miaohe Lin wrote: > Hi all, > When I was investigating the swap code, I found some possible race > windows. This series aims to fix all these races. But using current > get/put_swap_device() to guard against concurrent swapoff for > swap_readpage() looks terrible because swap_readpage() may take really > long time. And to reduce the performance overhead on the hot-path as > much as possible, it appears we can use the percpu_ref to close this > race window(as suggested by Huang, Ying). The patch 1 adds percpu_ref > support for swap and the rest of the patches use this to close various > race windows. More details can be found in the respective changelogs. > Thanks! > > Miaohe Lin (5): > mm/swapfile: add percpu_ref support for swap > swap: fix do_swap_page() race with swapoff > mm/swap_state: fix get_shadow_from_swap_cache() race with swapoff > mm/swap_state: fix potential faulted in race in swap_ra_info() > mm/swap_state: fix swap_cluster_readahead() race with swapoff Somehow I see Patch-1 and Patch-2 are missing on linux-mm[1]. Also I wanted to ask if you have a way to trigger this in a more controlled environment (consistently)? [1]: https://patchwork.kernel.org/project/linux-mm/cover/20210408130820.48233-1-linmiaohe@huawei.com/ -ritesh > > include/linux/swap.h | 4 +++- > mm/memory.c | 10 +++++++++ > mm/swap_state.c | 33 +++++++++++++++++++++-------- > mm/swapfile.c | 50 +++++++++++++++++++++++++++----------------- > 4 files changed, 68 insertions(+), 29 deletions(-) > > -- > 2.19.1 > >