Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp87763pxt; Thu, 5 Aug 2021 18:55:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxb5O3kWSohzmauer8wG/nN3Q4MMRzv1xv2xZh0Zy7UbDJryFEp3zWp/2rFNfyFk3d+4MUo X-Received: by 2002:a17:906:f1c4:: with SMTP id gx4mr7741526ejb.410.1628214944731; Thu, 05 Aug 2021 18:55:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628214944; cv=none; d=google.com; s=arc-20160816; b=kDwmVMXn7zbTZakw+Js8zSIpFCg3fDJq0A0jKXPkHUKwG32tgy9934jS8kNl5k/kNf e0bXAa9L1tIAg8SnZqSpHaRmhHPC/+Ne7XNiyW1qu+iIOa81ucgzhhR5fXvZc8m4fT5b dB+4MS9oK27K0TC89xspaqWfujxW9ruko98OZtPZRnXJXB3JUg9K4SMbdB5iVCDglZ16 Rm9YMorz89oEotdB3jo49oykGy9kU+LdwLD0IlJo7S29IGOnoFVrV/KjwubNghWqzeLX 7v97Y1mRKevuEcMw84AIubBjvrP66QYfNfgHxcLzm4I2svip496VepvAJDDczdlIo/0x Q/UQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=BZmonuIQTdAhHxcAtdvOowXsqN794Bg05ztX26jKcCI=; b=Rl/b7snIFygEnSBHmGRnXuofQMZmHGIH3E3qPsHnU+tWUrQSGkJ4OVkUbWd2QmUa7W +owojqtDUXOxqpuO1C+hJbyNV/+Wue/3iRXOEQ7v8KidG7BXAXdh/mHuaz7tM4gZM9J1 F7IyE/nD3lJSI8/Z4TqIke2pHXQJVbRo/8TsXN0sNhLg6eAd3G1tbQ6AxgleZx+ujAYz nqdkqr7A5+t/MVAc7GJZb5psXjd4av2sTrz0WX0/efEonV67lS9GryEmGf/glsS1JxrM Z8ZnS8Z3u7Ygr7zoJE470eyfWZp20AyoSJfqn/ihdXLM6gh6w3/q5I7XF2N8kFx7+oyu DjkQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=MKvCiDNE; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ji17si8192456ejc.714.2021.08.05.18.55.21; Thu, 05 Aug 2021 18:55:44 -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=@gmail.com header.s=20161025 header.b=MKvCiDNE; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232896AbhHEXJZ (ORCPT + 99 others); Thu, 5 Aug 2021 19:09:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48404 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229697AbhHEXJY (ORCPT ); Thu, 5 Aug 2021 19:09:24 -0400 Received: from mail-ej1-x633.google.com (mail-ej1-x633.google.com [IPv6:2a00:1450:4864:20::633]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9BE9CC0613D5 for ; Thu, 5 Aug 2021 16:09:09 -0700 (PDT) Received: by mail-ej1-x633.google.com with SMTP id u3so12224996ejz.1 for ; Thu, 05 Aug 2021 16:09:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=BZmonuIQTdAhHxcAtdvOowXsqN794Bg05ztX26jKcCI=; b=MKvCiDNEpYyA4lQihlVosLUnqVak2vs0tLKXVyxnBboi3U7GyHBcTHEb5bvLR2zNE+ 9teQVbu+Gpa58mDlhnrgRhg74OmHrgAb5Q7tmQGbAbCj7qSiTzJplS5QV43tQNpbYdzE F3RNSgwuUS1PkiYoLLUOm7xsXoOzjEm1FDq9+7MQaIknb55h0TVq5/mLGDp3ddtLV2s2 +zxWBkh76E6cJkuwqM9FdcJ05M9DF0pV4esUi2lKQNMPS53ap/WY6zQ4p7NAURFBXwmp tnZkB/aYUOBdxoiv+0SI0Epbv5h8iJ9G+p8NRMDsUdzkpp63PWspG83ongRFiVhOKSmI 7Rpg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=BZmonuIQTdAhHxcAtdvOowXsqN794Bg05ztX26jKcCI=; b=iF0vQG2VYBwS+YJwL2rX19RsHuKO/4kMWXH8RCXuFzHi3+S1BZM/5N8gavZR5POI1C 0dQ/HS1tBBeXiOiEMO/CXNKEJdNiXaOQnwFCfQzjJs83lY1VbW3FJnpDTYSrBP1UZFVm ZgrggYhKxYE30wX0hpFjwOF3dZavVxOoq8y8S3nHELz79BLW0GuiGZPn60tkV13vTOza HiSk6O5KyXkyAi5Z4G6DPMrveggE4/5AFxegXvaN1GfxTOhuLoauWGkgaRac2LlGr/TD 2+hOacrOBrdzS8XNqY2W2yHAC6iH6sYq2tyvlc+FMl4iRyzyohZ2NIHvxfi6a2YAXoml LUeg== X-Gm-Message-State: AOAM532d0E6ya6P6kHMyO7Y6tO9m7fusi1fscoS755S+guzw8dQsbHzX khZPqy7QZuWvUEd0n2uljf16mUALLcAY2jvbb1I= X-Received: by 2002:a17:906:c182:: with SMTP id g2mr6982687ejz.507.1628204948269; Thu, 05 Aug 2021 16:09:08 -0700 (PDT) MIME-Version: 1.0 References: <20210723080000.93953-1-ying.huang@intel.com> <24187e5e-069-9f3f-cefe-39ac70783753@google.com> <8735rr54i9.fsf@yhuang6-desk2.ccr.corp.intel.com> <704d597-443b-32f-84eb-524a58dd8ef@google.com> In-Reply-To: <704d597-443b-32f-84eb-524a58dd8ef@google.com> From: Yang Shi Date: Thu, 5 Aug 2021 16:08:56 -0700 Message-ID: Subject: Re: [PATCH] mm,shmem: Fix a typo in shmem_swapin_page() To: Hugh Dickins Cc: Matthew Wilcox , "Huang, Ying" , Andrew Morton , David Hildenbrand , Linux MM , Linux Kernel Mailing List , Miaohe Lin , Johannes Weiner , Michal Hocko , Joonsoo Kim , Minchan Kim Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Aug 3, 2021 at 10:34 PM Hugh Dickins wrote: > > 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 forgot the exact version, but definitely not 4.1 or earlier. Maybe 4.19 or earlier. I'm not familiar with how block layer detect congestion, if the logic was changed, hence the optimization doesn't stand anymore nowadays, I'm totally fine to remove it. > > 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