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=-13.3 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_IN_DEF_DKIM_WL 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 4603BC4338F for ; Wed, 4 Aug 2021 05:34:58 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id CF47660F10 for ; Wed, 4 Aug 2021 05:34:57 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org CF47660F10 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 6F6DA8D0032; Wed, 4 Aug 2021 01:34:57 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6A5DC8D002D; Wed, 4 Aug 2021 01:34:57 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 594FA8D0032; Wed, 4 Aug 2021 01:34:57 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 3C8CD8D002D for ; Wed, 4 Aug 2021 01:34:57 -0400 (EDT) Received: from smtpin39.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id D52C88249980 for ; Wed, 4 Aug 2021 05:34:56 +0000 (UTC) X-FDA: 78436284192.39.E83A9D0 Received: from mail-qv1-f46.google.com (mail-qv1-f46.google.com [209.85.219.46]) by imf11.hostedemail.com (Postfix) with ESMTP id 973A0F00A287 for ; Wed, 4 Aug 2021 05:34:56 +0000 (UTC) Received: by mail-qv1-f46.google.com with SMTP id 3so620923qvd.2 for ; Tue, 03 Aug 2021 22:34:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:in-reply-to:message-id:references :mime-version; bh=AzPTuvmtk/GmKeGcg4Ye3QqV4cGp0sQpwmlvW0kRJJk=; b=RCPwO6hRr+av+1TT+ydq43h1ySz0YZWTtmBZqcDXziElHt/whPrqj9xq7JESmEcZQX 3X+L9iF/HtcZZ7Oj4QZElfgxLS31qX3z68KdmJYzgYnx638HwSUeRCQGU0v8AWv0l+2H FM8eKXRz6GRRvWAA8VQjDh3/wMCJu31TO6D3dCrsJIyAsqqc7HwHqtAJ1rqmgZXee1sP SgNE9i7TDGNCSh7cWUpyIyozYQRrFg0k+6pbfxDZHbCvp1tL0TS5tdN7mRoXqMGKCu4b gVtRREJNTm7Sn2YF7cTmcJnkcnLp0p1scSTZ2xXY8j063ifmkQEcYZr0OxXsiYo5Kkd4 cGZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:in-reply-to:message-id :references:mime-version; bh=AzPTuvmtk/GmKeGcg4Ye3QqV4cGp0sQpwmlvW0kRJJk=; b=JY+/4f5PXh5HdD0wEqslU1KdhvLSx80PSkMftMZtJ9KaB9iWr3IsXIa71gGUvpfJJt ugKsh55hrr9GfJN8eCVlgI90VZxpGWK+6P55Ky7MAUlSF/0vU6rTuO8t7QCohFYjH8EV RH536Bute3gM95LbD2qkWFlz1hGcL9+BtBONXFDZ7qwivNAMDTk3UYy1Xi1QNEqLOW/R SSdcQ3K3Ex3I4ehK2gSUM9GgSCi08UGbGuWC940L8xm4SnWYORTycuhelHsVutYcTmVB hACReTgxpnZt+fcVoFYCcbG3kZ0+NmFec/YlohFFK67jESRnBzkwVErEgSxpfnaMM4Sf 1MYA== X-Gm-Message-State: AOAM530VDGcx8+pe32iB8EqTeGiQDA+8mK9HkYaizMpjMbyPj5G2JmMF rOh92h++usH5pGAwerNx/eOq+w== X-Google-Smtp-Source: ABdhPJytPEx6Dv0bP6IEhekqVhpVIcpWjN5uD5TH0ScarA7l0AYpaYrDfMGvvj9ftMliIKmrv9b02w== X-Received: by 2002:a05:6214:f0c:: with SMTP id gw12mr25258192qvb.33.1628055295705; Tue, 03 Aug 2021 22:34:55 -0700 (PDT) Received: from ripple.attlocal.net (172-10-233-147.lightspeed.sntcca.sbcglobal.net. [172.10.233.147]) by smtp.gmail.com with ESMTPSA id h68sm742610qkf.126.2021.08.03.22.34.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Aug 2021 22:34:54 -0700 (PDT) Date: Tue, 3 Aug 2021 22:34:52 -0700 (PDT) From: Hugh Dickins X-X-Sender: hugh@ripple.anvils To: Matthew Wilcox cc: "Huang, Ying" , Hugh Dickins , Andrew Morton , David Hildenbrand , Yang Shi , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Miaohe Lin , Johannes Weiner , Michal Hocko , Joonsoo Kim , Minchan Kim Subject: Re: [PATCH] mm,shmem: Fix a typo in shmem_swapin_page() In-Reply-To: Message-ID: <704d597-443b-32f-84eb-524a58dd8ef@google.com> References: <20210723080000.93953-1-ying.huang@intel.com> <24187e5e-069-9f3f-cefe-39ac70783753@google.com> <8735rr54i9.fsf@yhuang6-desk2.ccr.corp.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 973A0F00A287 Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=google.com header.s=20161025 header.b=RCPwO6hR; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf11.hostedemail.com: domain of hughd@google.com designates 209.85.219.46 as permitted sender) smtp.mailfrom=hughd@google.com X-Stat-Signature: fa7uoibojoax8pne6n1mjs7mf8ggo8im X-HE-Tag: 1628055296-681713 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, 3 Aug 2021, Matthew Wilcox wrote: > On Tue, Aug 03, 2021 at 04:14:38PM +0800, Huang, Ying wrote: > > Matthew Wilcox writes: > > > But I REALLY REALLY REALLY want a reproducer. Right now, I have a hard > > > time believing this, or any of the other races can really happen. > > > > I think the race is only theoretical too. Firstly, swapoff is a rare > > operations in practice; secondly, the race window is really small. > > So do something to provoke it. Widen the window. Put an msleep(1000) > between *pagep = NULL and the call to get_swap_device(). That's assuming > that the swapon/swapoff loop that I proposed doesn't work. Did you > try it? I've been doing that swapon/swapoff loop for years, while running kernel builds on tmpfs going out to swap; for better or worse on baremetal not VM. You're right that few will ever need that level of reliability; but it has caught problems from time to time, and I do insist on fixing them. I'm not as insistent as you on wanting a reproducer; and we all take pride sometimes in fixing ever more inconceivable bugs. I'm not against that, but it's easy to end up with a fix more dangerous than what it claims to fix, rather like with random newbie cleanups. I've never seen the swapoff race claimed by Miaohe, and don't expect to; but he's probably right, given the current code. I just dislike adding unnecessary complexity, and siting it in the wrong place (mm/shmem.c). Yang, is it possible that 5.1 commit 8fd2e0b505d1 ("mm: swap: check if swap backing device is congested or not") was actually developed and measured on 4.1 or earlier, which still had blk_set_queue_congested()? I cannot explain its usefulness nowadays, on congested HDD anyway: Matthew is right that NFS and a few others may still be setting congested flags, but they're not what that commit was proposed for. If it is still useful, then I contend (but Huang Ying will disagree) that the get_swap_device() and put_swap_device() should be around 8fd2e0b505d1's inode_read_congested() block in swap_cluster_readahead(), not encroaching into mm/shmem.c. But if that block is not useful, then it should simply be removed (later). Hugh