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=-5.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 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 C8FDDC433E3 for ; Thu, 20 Aug 2020 01:24:26 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 87A112078D for ; Thu, 20 Aug 2020 01:24:26 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="XRYxVpr4" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 87A112078D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 2C02A6B0007; Wed, 19 Aug 2020 21:24:26 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 24A328D0005; Wed, 19 Aug 2020 21:24:26 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0EABE6B000A; Wed, 19 Aug 2020 21:24:26 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0149.hostedemail.com [216.40.44.149]) by kanga.kvack.org (Postfix) with ESMTP id E95DD6B0007 for ; Wed, 19 Aug 2020 21:24:25 -0400 (EDT) Received: from smtpin27.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id ABF0D1EF3 for ; Thu, 20 Aug 2020 01:24:25 +0000 (UTC) X-FDA: 77169201690.27.slave44_400c5472702c Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin27.hostedemail.com (Postfix) with ESMTP id 7CD913D668 for ; Thu, 20 Aug 2020 01:24:25 +0000 (UTC) X-HE-Tag: slave44_400c5472702c X-Filterd-Recvd-Size: 5663 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by imf14.hostedemail.com (Postfix) with ESMTP for ; Thu, 20 Aug 2020 01:24:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1597886664; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=WjUMl2kvI2SWf67XAmHmBJUIFFn0OB41n2Xt50LZy2w=; b=XRYxVpr491Yb+bRHergebupGyr7KiJQ1UybOsljP8E4wHQT6Y5D/Yo76GghsP0ZfkYmWhZ Icp1sfzgc/QRsuz168LeeOPXiCpsDOocUpcBsupp/otyvFFPw9yKLJVBlk53PcujP17c1e o3Ur+jhJC97XwQMqUpNvU+RocaxADZs= Received: from mail-pf1-f198.google.com (mail-pf1-f198.google.com [209.85.210.198]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-567-AdPP1ntxO12fqOzrh7CHmw-1; Wed, 19 Aug 2020 21:24:22 -0400 X-MC-Unique: AdPP1ntxO12fqOzrh7CHmw-1 Received: by mail-pf1-f198.google.com with SMTP id f5so224160pfe.2 for ; Wed, 19 Aug 2020 18:24:22 -0700 (PDT) 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:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=WjUMl2kvI2SWf67XAmHmBJUIFFn0OB41n2Xt50LZy2w=; b=Ou6+CsbNGCdnb4GNs8aRj2TrCN3sfxYPcTEZmkuyYGhO3ssVWnGYUVxqh4KAcSbZVS oatp5+xOSBU/SkHy6vtbqFNlyOIPLTd2m17Zw0S+H85/4kEwy0C0AF7KGcRfM+VPVEJo 3sCpx2vJkxn5o5V2u2A0ykcCYIykx0O7D4ypT/wRqzRaeKehHb3KwtBEILNIWuGA29zu oMjI3/De2kWWFxjC8v09CWZyMbV+Rp5r+bGzx2DtsvPaWCAV4uyy1hgfLKPW/COvpYob USgPyDSci2duMWf01RE1Hu4JK+AewpDmr7F3Htq9aaWh3FT23ioKyBuFdw7mDA6RFhHB MnMg== X-Gm-Message-State: AOAM532XYE9GcaopX9D+GDzeyu8+Z6P33Vnro9k9R7iJqFi/ZbnMg9H+ GnQ3dPJ2TbtOtfxNdoTYJGxlq3owUPeGaneSTKiL7iUPIMpDNSIYg4TQ7j7OVF4o1m31KRellPF cCdx9+r1BU5E= X-Received: by 2002:a17:90a:6d96:: with SMTP id a22mr464528pjk.165.1597886661326; Wed, 19 Aug 2020 18:24:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJznZQrOjFKArbT3Fe5xmkGGfKX9NSSvbVErYE0AQ15q2c+Bsrk3JIzM5qQom2dXOfnnMQ6c1g== X-Received: by 2002:a17:90a:6d96:: with SMTP id a22mr464511pjk.165.1597886661025; Wed, 19 Aug 2020 18:24:21 -0700 (PDT) Received: from xiangao.remote.csb ([209.132.188.80]) by smtp.gmail.com with ESMTPSA id b185sm491513pfg.71.2020.08.19.18.24.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Aug 2020 18:24:20 -0700 (PDT) Date: Thu, 20 Aug 2020 09:24:09 +0800 From: Gao Xiang To: Yang Shi Cc: Andrew Morton , Linux MM , Linux Kernel Mailing List , Rafael Aquini , Carlos Maiolino , Eric Sandeen , "Huang, Ying" , stable Subject: Re: [PATCH] mm, THP, swap: fix allocating cluster for swapfile by mistake Message-ID: <20200820012409.GB5846@xiangao.remote.csb> References: <20200819195613.24269-1-hsiangkao@redhat.com> <20200819130506.eea076dd618644cd7ff875b6@linux-foundation.org> <20200819201509.GA26216@xiangao.remote.csb> MIME-Version: 1.0 In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=hsiangkao@redhat.com X-Mimecast-Spam-Score: 0.002 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Rspamd-Queue-Id: 7CD913D668 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam02 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: Hi Yang, On Wed, Aug 19, 2020 at 02:41:08PM -0700, Yang Shi wrote: > On Wed, Aug 19, 2020 at 1:15 PM Gao Xiang wrote: > > > > Hi Andrew, > > > > On Wed, Aug 19, 2020 at 01:05:06PM -0700, Andrew Morton wrote: > > > On Thu, 20 Aug 2020 03:56:13 +0800 Gao Xiang wrote: > > > > > > > SWP_FS doesn't mean the device is file-backed swap device, > > > > which just means each writeback request should go through fs > > > > by DIO. Or it'll just use extents added by .swap_activate(), > > > > but it also works as file-backed swap device. > > > > > > This is very hard to understand :( > > > > Thanks for your reply... > > > > The related logic is in __swap_writepage() and setup_swap_extents(), > > and also see e.g generic_swapfile_activate() or iomap_swapfile_activate()... > > I think just NFS falls into this case, so you may rephrase it to: > > SWP_FS is only used for swap files over NFS. So, !SWP_FS means non NFS > swap, it could be either file backed or device backed. Thanks for your suggestion... That looks reasonable, and after I looked bc4ae27d817a ("mm: split SWP_FILE into SWP_ACTIVATED and SWP_FS") I think it could be rephrased into " The SWP_FS flag is used to make swap_{read,write}page() go through the filesystem, and it's only used for swap files over NFS. So, !SWP_FS means non NFS for now, it could be either file backed or device backed. Something similar goes with legacy SWP_FILE. " Does it look sane? And I will wait for further suggestion about this for a while. And IMO, SWP_FS flag might be useful for other uses later (e.g. laterly for some CoW swapfile use, but I don't think carefully if it's practical or not...) Thanks, Gao Xiang