Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp266230ioo; Thu, 26 May 2022 03:14:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyIUv7sl/dx3G4bRwjX0McaFaNFKu8HclsYk8rbx9P+PUyqGDWwpp9d2z7uPr6aJcYt44pi X-Received: by 2002:a17:907:7b95:b0:6f4:ff03:981a with SMTP id ne21-20020a1709077b9500b006f4ff03981amr33328357ejc.653.1653560069789; Thu, 26 May 2022 03:14:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653560069; cv=none; d=google.com; s=arc-20160816; b=OZNHjkJkhf1+2cXzovCxCL391fZVdS3UybkALz6w8y+BLs8xUg8kBZY+wREpeoC6dX 57rD4Pi52ySrph8aZBJrZiTOsL0RsWRnrzE8cwElcjF89i/3prvzk90+Lf6RHj8kiFYD EkUXjUt1pHLBxyuNXJ7KOpMdQ/lUjQbzW5+wOFtFUvQM50FQWkbJI85S12XtcIV0P7cK u4JdVIAAw6yLzx2NfmCpL2DS7Qc4aBd7bv7Hg/Glqvs+d92I/J7jkk2deMmg2U+lmsi9 lLZzItzcnHfOroQSPUDjI4H4DWBI31pvinprsbncNkReCdpIdlZluE/SlYEXtWlnuZc4 eSIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=P/VH5hrjo42Os36s3rt6PKOnHvpE84DALu4RhbUh3+s=; b=budgQpPiIhm3n/dhoGoOkJmoeK2vXtbrcbCiJO5jczi78n7W1TACR8iJTjxm9DwbGB ZyD545w08ariqQUYfIb0CpF98RO8CjM9Oam3qJ8fRLcYumDeHHiHwxlAAd2+FKu44NC2 RWqiwx8sWfvvs6A/cDgpVvT+r8B+qJn1zeQLqFOefAD+7ZTzz6PYWv7vYonJvC6LpFjx do52DRFrK31WHDs55we2Hmf8hZbSQrjAffGk83QcLhJNP77NTitC5a3yhYeMQJmT8EaO PH3/d5R3x+rk3p15vMKffxOFd6W49pzKhVKoSk+l7CmxVI2PEtpD69dYiobsZWfbxx8k vXvg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dm4-20020a170907948400b006feed26a290si1281971ejc.42.2022.05.26.03.14.02; Thu, 26 May 2022 03:14:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-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; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242645AbiEYQyw (ORCPT + 99 others); Wed, 25 May 2022 12:54:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60210 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234485AbiEYQys (ORCPT ); Wed, 25 May 2022 12:54:48 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 340758A32E for ; Wed, 25 May 2022 09:54:47 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id CA8F7616EF for ; Wed, 25 May 2022 16:54:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 06D9DC385B8; Wed, 25 May 2022 16:54:42 +0000 (UTC) Date: Wed, 25 May 2022 17:54:39 +0100 From: Catalin Marinas To: Barry Song <21cnbao@gmail.com> Cc: Andrew Morton , Will Deacon , Linux-MM , LAK , LKML , hanchuanhua , =?utf-8?B?5byg6K+X5piOKFNpbW9uIFpoYW5nKQ==?= , =?utf-8?B?6YOt5YGl?= , Barry Song , "Huang, Ying" , Minchan Kim , Johannes Weiner , Hugh Dickins , Shaohua Li , Rik van Riel , Andrea Arcangeli , Steven Price Subject: Re: [PATCH] arm64: enable THP_SWAP for arm64 Message-ID: References: <20220524071403.128644-1-21cnbao@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-6.7 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_HI,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-kernel@vger.kernel.org On Wed, May 25, 2022 at 11:10:41PM +1200, Barry Song wrote: > On Wed, May 25, 2022 at 7:14 AM Catalin Marinas wrote: > > I think this should work and with your other proposal it would be > > limited to MTE pages: > > > > #define arch_thp_swp_supported(page) (!test_bit(PG_mte_tagged, &page->flags)) > > > > Are THP pages loaded from swap as a whole or are they split? IIRC the > > i can confirm thp is written as a whole through: > [ 90.622863] __swap_writepage+0xe8/0x580 > [ 90.622881] swap_writepage+0x44/0xf8 > [ 90.622891] pageout+0xe0/0x2a8 > [ 90.622906] shrink_page_list+0x9dc/0xde0 > [ 90.622917] shrink_inactive_list+0x1ec/0x3c8 > [ 90.622928] shrink_lruvec+0x3dc/0x628 > [ 90.622939] shrink_node+0x37c/0x6a0 > [ 90.622950] balance_pgdat+0x354/0x668 > [ 90.622961] kswapd+0x1e0/0x3c0 > [ 90.622972] kthread+0x110/0x120 > > but i have never got a backtrace in which thp is loaded as a whole though it > seems the code has this path: > int swap_readpage(struct page *page, bool synchronous) > { > ... > bio = bio_alloc(sis->bdev, 1, REQ_OP_READ, GFP_KERNEL); > bio->bi_iter.bi_sector = swap_page_sector(page); > bio->bi_end_io = end_swap_bio_read; > bio_add_page(bio, page, thp_size(page), 0); > ... > submit_bio(bio); > } > > > splitting still happens but after the swapping out finishes. Even if > > they are loaded as 4K pages, we still have the mte_save_tags() that only > > understands small pages currently, so rejecting THP pages is probably > > best. > > as anyway i don't have a mte-hardware to do a valid test to go any > further, so i will totally disable thp_swp for hardware having mte for > this moment in patch v2. It makes sense. If we decide to improve this for MTE, we'll change the arch check. Thanks. -- Catalin