Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp1232175iob; Wed, 4 May 2022 18:12:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxoGIeBeYDlpyVttnV2aChRsKPzmeGTeQqxm0Ynp/57rR6PPCf6YptaR9IPr2Roxl1n4Hua X-Received: by 2002:a17:902:7c13:b0:156:ca91:877f with SMTP id x19-20020a1709027c1300b00156ca91877fmr24775384pll.15.1651713136192; Wed, 04 May 2022 18:12:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651713136; cv=none; d=google.com; s=arc-20160816; b=ObL+JYABDIdV3ipXnApQx9EOHGftDwBB1169/KHOq8EeCwefmbxowTTpExpVmsFgns B0i87ofkIpHohhwRIGMlyM6UsPS5ImjUkliIuL0v8fSlHsTGHGZ5gI8M6RklZb7I0N3z UG8hBuJcGgLX1U3achsJLh/TQ21cRMDPgTWDkb4V1HQBw/NnIP55lesAPpKet6HQgDnj JKlWeHwzm2X1/V8S6N01dRKLhWk113GqO5YxB/avEbMTq87kjInUj+oJdXfYGnEbHj/U mvGjZPwnd4CREgyd5prtViSc/aU70j4rNi6SY4/nc9gvZl/+XJsNSnCHrwrAxfIESBZX ERIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:references:in-reply-to:subject :cc:to:from:mime-version:content-transfer-encoding:dkim-signature :dkim-signature; bh=AfEAmNadKBsyJGPHhIrqELUvuuTnv3+PkANYskYe9Z0=; b=Q9BhZjPpXKdefD2NVHeqeR36/MH78rmkF+lvf8zqVNs2YD0vb+JxdAIFCt6lk++LNE wYyAoni7DSne5fT6rPJ6tsWcQ0FJchHupnmK6MmsKyUrLe7D3f3hBizcQGoIyPHj+hup qVl/HkEbWUkfXVPmdiOn38e1TwQnbWbq6CBrcGRPBsXA2PW6lYVqYe4NQcOurqXtT8FG 93umZuUk85qd/Ua3OmJbJkWTuGXDWXPisU9MwAw2PdB04AmTnOkgBvGAmkggMJYi2Mta zJPph7Zp/4XL/U20D6Wc7xXBpowUDJ9A9K5IbbSy72+GcAO4YvK4L7krll1akPzrnvdp lBfw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=HP9Mdd0y; dkim=neutral (no key) header.i=@suse.de header.b=baAopqfn; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p1-20020a63b801000000b0039822e42cbasi1941pge.427.2022.05.04.18.11.48; Wed, 04 May 2022 18:12:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=HP9Mdd0y; dkim=neutral (no key) header.i=@suse.de header.b=baAopqfn; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237042AbiEEAFC (ORCPT + 99 others); Wed, 4 May 2022 20:05:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57900 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351580AbiEDXpn (ORCPT ); Wed, 4 May 2022 19:45:43 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EBB4A21E3B; Wed, 4 May 2022 16:42:04 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 695201F745; Wed, 4 May 2022 23:42:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1651707723; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=AfEAmNadKBsyJGPHhIrqELUvuuTnv3+PkANYskYe9Z0=; b=HP9Mdd0yAlGwCYu5G+uJ3VejgPUOyGqL96rsTA3rLVta8BIpQlcOHOnWQqLYj/g+dJevsx go/q/geAcVFpjCmAsZlJR5mjce9eJQ1f5MqbY6lz7JmDcbqzw+en7IlUUmewUnxqRPtsi6 oO4oYZUiReSD+rAaAsK723I3eNXWdgA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1651707723; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=AfEAmNadKBsyJGPHhIrqELUvuuTnv3+PkANYskYe9Z0=; b=baAopqfnk2KDxhB0joCqS5hQX4Zdx8yytBWV2UbF+3CqxSx6C28g7OxO8YVGZIVvKZNCEG VvVPfKJmMxfQDYCw== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 9D8D4131BD; Wed, 4 May 2022 23:42:00 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id a/7yFUgPc2JxXAAAMHmgww (envelope-from ); Wed, 04 May 2022 23:42:00 +0000 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 From: "NeilBrown" To: "Yang Shi" Cc: "Huang Ying" , "Andrew Morton" , "Geert Uytterhoeven" , "Christoph Hellwig" , "Miaohe Lin" , linux-nfs@vger.kernel.org, "Linux MM" , "Linux Kernel Mailing List" Subject: Re: [PATCH 1/2] MM: handle THP in swap_*page_fs() In-reply-to: References: <165119280115.15698.2629172320052218921.stgit@noble.brown>, <165119301488.15698.9457662928942765453.stgit@noble.brown>, , <165146539609.24404.4051313590023463843@noble.neil.brown.name>, Date: Thu, 05 May 2022 09:41:56 +1000 Message-id: <165170771676.24672.16520001373464213119@noble.neil.brown.name> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org On Tue, 03 May 2022, Yang Shi wrote: > On Sun, May 1, 2022 at 9:23 PM NeilBrown wrote: > > > > On Sat, 30 Apr 2022, Yang Shi wrote: > > > On Thu, Apr 28, 2022 at 5:44 PM NeilBrown wrote: > > > > > > > > Pages passed to swap_readpage()/swap_writepage() are not necessarily = all > > > > the same size - there may be transparent-huge-pages involves. > > > > > > > > The BIO paths of swap_*page() handle this correctly, but the SWP_FS_O= PS > > > > path does not. > > > > > > > > So we need to use thp_size() to find the size, not just assume > > > > PAGE_SIZE, and we need to track the total length of the request, not > > > > just assume it is "page * PAGE_SIZE". > > > > > > Swap-over-nfs doesn't support THP swap IIUC. So SWP_FS_OPS should not > > > see THP at all. But I agree to remove the assumption about page size > > > in this path. > > > > Can you help me understand this please. How would the swap code know > > that swap-over-NFS doesn't support THP swap? There is no reason that > > NFS wouldn't be able to handle 2MB writes. Even 1GB should work though > > NFS would have to split into several smaller WRITE requests. >=20 > AFAICT, THP swap is only supported on non-rotate block devices, for > example, SSD, PMEM, etc. IIRC, the swap device has to support the > cluster in order to swap THP. The cluster is only supported by > non-rotate block devices. >=20 > Looped Ying in, who is the author of THP swap. I hunted around the code and found that THP swap only happens if a 'cluster_info' is allocated, and that only happens if=20 if (p->bdev && bdev_nonrot(p->bdev)) { in the swapon syscall. I guess "nonrot" is being use as a synonym for "low latency"... So even if NFS was low-latency it couldn't benefit from THP swap. So as you say it is not currently possible for THP pages to be send to NFS for swapout. It makes sense to prepare for it though I think - if only so that the code is more consistent and less confusing. Thanks, NeilBrown