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 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 938CCC43334 for ; Wed, 20 Jul 2022 09:18:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=+QGjJx4Zuxxx9l/IM+mIzTE+JrWPdwqsH/c3eO9YPZw=; b=PFKW+BQXJudSkO loq/oKUjInbycp2DNFmYMck++sguL5pDj8Oy1dhAtnKrwgOIIjlByYANCUdtIZTyFlFpmx3SYrwrl DRasIeG3eyIAbfsTDcHbXPcCJC4+av86cOxPYS6qCMtnAtNsgBDCjzwCZmrLA5sy9WGJr+JmlNMwZ ewdWCeQdDFE/JMPgcy785AQLvgb8b99sy1ndGz4d3vuokh3cHPjERDRA5+YJiDo5yIUxSd6sXIU7/ 5eRVYcmMXpwQv1CG6pU4Oc6Ga7JsYiRS7pU08PaD/4VRePxiMeCBreAdDVdppfq8diTSIxhuGb1Dd PcDaFCogGIX5VI/oBXNA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oE5ph-0039Da-8l; Wed, 20 Jul 2022 09:17:29 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oE5pd-00399w-NV for linux-arm-kernel@lists.infradead.org; Wed, 20 Jul 2022 09:17:27 +0000 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 19BDC61AF6; Wed, 20 Jul 2022 09:17:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EE623C3411E; Wed, 20 Jul 2022 09:17:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1658308644; bh=0zBO6umFFIrPrU7UNFUykMRqo+BjUg3C8nb2Lh1VYyA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=S4ozL+iug/6wm07GUIQUZ4Z2Awe27I83BkiycWryzvxkLp2BTN0DMSBdRZ7EzPEZH Ytt/0e4GJzdbQ2RDKIauTx+oJZrhV7vP4GCgY7aDqjCAjQmNRVPxOWWaRr0EkEBqJk gCMl4zssRtQGVIzf8FLMzeaicZHmUwKENIdQ6ZEk/iS95bJDeFTOxwrmAs52+L6GjN 2Cc9R15r5KX07Amhh1D7KPlXEJbvVZjGEaojkIiLm9AEIA5KdrhWmKq79EpH0YPqkG P8ISZpVshT8s7FoUIvPrdmCK0G0U4LJU1xDdD5zCCZjWpwLemLYzSsVbUsubkUP4jI RZLGDyFjfRrjg== Date: Wed, 20 Jul 2022 10:17:16 +0100 From: Will Deacon To: Anshuman Khandual Cc: Barry Song <21cnbao@gmail.com>, "Huang, Ying" , Andrew Morton , Catalin Marinas , LAK , Linux-MM , Steven Price , Andrea Arcangeli , =?utf-8?B?6YOt5YGl?= , hanchuanhua , Johannes Weiner , Hugh Dickins , LKML , Minchan Kim , Yang Shi , Barry Song , =?utf-8?B?5byg6K+X5piOKFNpbW9uIFpoYW5nKQ==?= Subject: Re: [RESEND PATCH v3] arm64: enable THP_SWAP for arm64 Message-ID: <20220720091716.GA15752@willie-the-truck> References: <20220718090050.2261-1-21cnbao@gmail.com> <87mtd62apo.fsf@yhuang6-desk2.ccr.corp.intel.com> <87zgh5232o.fsf@yhuang6-desk2.ccr.corp.intel.com> <416a06f6-ca7d-d4a9-2cda-af0ad6e28261@arm.com> <05639c8d-73f7-7e12-9941-cae3037e44b4@arm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220720_021725_880030_22D8C89D X-CRM114-Status: GOOD ( 22.33 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, Jul 20, 2022 at 08:06:42AM +0530, Anshuman Khandual wrote: > On 7/20/22 07:16, Barry Song wrote: > > On Tue, Jul 19, 2022 at 4:04 PM Anshuman Khandual > > wrote: > >> On 7/19/22 09:29, Barry Song wrote: > >>> On Tue, Jul 19, 2022 at 3:35 PM Anshuman Khandual > >>> wrote: > >>>> On 7/19/22 08:58, Huang, Ying wrote: > >>>>> Anshuman Khandual writes: > >>>>>>>> How about the following? > >>>>>>>> > >>>>>>>> static inline bool arch_wants_thp_swap(void) > >>>>>>>> { > >>>>>>>> return IS_ENABLED(ARCH_WANTS_THP_SWAP); > >>>>>>>> } > >>>>>>> > >>>>>>> This looks good. then i'll need to change arm64 to > >>>>>>> > >>>>>>> +static inline bool arch_thp_swp_supported(void) > >>>>>>> +{ > >>>>>>> + return IS_ENABLED(ARCH_WANTS_THP_SWAP) && !system_supports_mte(); > >>>>>>> +} > >>>>>> > >>>>>> Why ? CONFIG_THP_SWAP depends on ARCH_WANTS_THP_SWAP. In folio_alloc_swap(), > >>>>>> IS_ENABLED(CONFIG_THP_SWAP) enabled, will also imply ARCH_WANTS_THP_SWAP too > >>>>>> is enabled. Hence checking for ARCH_WANTS_THP_SWAP again does not make sense > >>>>>> either in the generic fallback stub, or in arm64 platform override. Because > >>>>>> without ARCH_WANTS_THP_SWAP enabled, arch_thp_swp_supported() should never > >>>>>> be called in the first place. > >>>>> > >>>>> For the only caller now, the checking looks redundant. But the original > >>>>> proposed implementation as follows, > >>>>> > >>>>> static inline bool arch_thp_swp_supported(void) > >>>>> { > >>>>> return true; > >>>>> } > >>>>> > >>>>> will return true even on architectures that don't support/want THP swap. > >>>> > >>>> But the function will never be called on for those platforms. > >>>> > >>>>> That will confuse people too. > >>>> > >>>> I dont see how. > >>>> > >>>>> > >>>>> And the "redundant" checking has no run time overhead, because compiler > >>>>> will do the trick. > >>>> I understand that, but dont think this indirection is necessary. > >>> > >>> Hi Anshuman, Hi Ying, > >>> Thanks for the comments of both of you. Does the below look ok? > >>> > >>> generic, > >>> > >>> static inline bool arch_wants_thp_swap(void) > >>> { > >>> return IS_ENABLED(CONFIG_THP_SWAP); > >>> } > >>> > >>> arm64, > >>> > >>> static inline bool arch_thp_swp_supported(void) > >>> { > >>> return IS_ENABLED(CONFIG_THP_SWAP) && !system_supports_mte(); > >>> } > >>> > >>> caller, > >>> > >>> folio_alloc_swap(struct folio *folio) > >>> { > >>> > >>> if (folio_test_large(folio)) { > >>> - if (IS_ENABLED(CONFIG_THP_SWAP)) > >>> + if (arch_thp_swp_supported()) > >>> get_swap_pages(1, &entry, folio_nr_pages(folio)); > >>> goto out; > >>> } > >> > >> Current proposal in this patch LGTM, I dont see any reason for these changes. > > > > OK, thanks, Anshuman. Can I collect this as a Reviewed-by? > > Yes please. > > Reviewed-by: Anshuman Khandual I've lost track of exactly what the outcome here is, so Barry, please can you send a final version of the agreed-upon patch? Thanks, Will _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel