Received: by 2002:a05:6358:53a8:b0:117:f937:c515 with SMTP id z40csp2952929rwe; Sun, 16 Apr 2023 08:36:13 -0700 (PDT) X-Google-Smtp-Source: AKy350ZkV/RwxwPeWLbOjH1sCRe3JH1Gvw/29ugyoXDvS3jVvgyaV+x/S1FkDkOaxn4MFCpJqGlZ X-Received: by 2002:a17:90a:cb83:b0:23d:10f2:bda2 with SMTP id a3-20020a17090acb8300b0023d10f2bda2mr12451933pju.30.1681659372950; Sun, 16 Apr 2023 08:36:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681659372; cv=none; d=google.com; s=arc-20160816; b=dI/7e1b0irXT7v/9rflL4sSYYLX2d94msZxaTLMlLVd+fxK+9ywxVNNQ+g7GNaCF4C gZ4Xu1tVZcF6oimffL7UfRQ56ksY1HaSOrKe3BvSP0rSXt1fjfxrs8Ha39MkrDZ2Ha8f vWM8DTvI53dMCvTdDbe0AmUPN4YVaLt/rGFTOL7pEHYvGAhf5euxiwmX9KEVkZHcBXZE 0Lq41xBSXPul6jT0lb6TCVB/uLZQYibWRNEvHw8jFLi5I0gX2tEg7/YX3yzdWP1ILr5m gOQj9J5je9NdoBukerE4xTi2VH/B8YkOfvbK0IIQzI+GGWEzA7WWxtwka1P0TwmROKlM t0lg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:message-id:user-agent :references:in-reply-to:subject:cc:to:from:date:mime-version :dkim-signature:dkim-signature; bh=+ZJdDeYoccvK0HkfZcO7TKPtQnPVDW+juR9W+3yn6l0=; b=b3eC07f/r2pUTDM+nEsN+QRLZGfBf2wjTcb+0axMgVWxwwyeOTCReQ1Ur57aOiVLOy 5BdIw9xBdhGq3gCrwTEJVPcnh6Z1MlwQ0E7By0TdCaegi1kNlRXjhlj5B6G2zN/ibmW3 5AjNm3WdSLJOvsOQBE38BLTJETGuSfb9zipPJgemLSBG0m/KzFPSYP12lYxUzrGO/uIb SFVfvuJm9Wuj1xeA7sH5KpjhgywBpeIY9i829B8Jc7OAxtD4nCl0SfzjJrjCiUKVOMDt NqwNw5oLbFkgjCFDFpFOwHbFO3z+TSohL3MvDYZt7ehbjGwbGnGWnIe7CP6NZRXoftZq PItA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=n+as61N+; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; 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=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 h11-20020a65480b000000b0051420373a5asi9457196pgs.679.2023.04.16.08.36.00; Sun, 16 Apr 2023 08:36:12 -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; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=n+as61N+; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; 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=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229656AbjDPPbk (ORCPT + 99 others); Sun, 16 Apr 2023 11:31:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41740 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229549AbjDPPbj (ORCPT ); Sun, 16 Apr 2023 11:31:39 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7FD9D1FFF for ; Sun, 16 Apr 2023 08:31:36 -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-out1.suse.de (Postfix) with ESMTPS id F354421A46; Sun, 16 Apr 2023 15:31:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1681659095; 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=+ZJdDeYoccvK0HkfZcO7TKPtQnPVDW+juR9W+3yn6l0=; b=n+as61N+wacLx7P05kktsBpbfDQKvK0c2YJIa4e7efa5bhuUcuNv2Eck0e1JSvbyBmST6+ X5ABuiopqzgXJFG0y4FU4VX7va6HyqbaZrZlbqx/EBn+v8yWZgOq4wsyEp63AknzstmGFQ Gcq1c131g9PYxmdHk3j1udUYR6x8thk= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1681659095; 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=+ZJdDeYoccvK0HkfZcO7TKPtQnPVDW+juR9W+3yn6l0=; b=QIK/QEtIhWQYMGksEFEEVH7IUrM7gvsqnBDzRxMb07FBHfDCF5iAGWb738lJ/gi6wKClqr /8W7zMaQMQepQ0CA== 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 E3DF713498; Sun, 16 Apr 2023 15:31:34 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id nCJgN9YUPGTtbAAAMHmgww (envelope-from ); Sun, 16 Apr 2023 15:31:34 +0000 MIME-Version: 1.0 Date: Sun, 16 Apr 2023 17:31:34 +0200 From: Oscar Salvador To: Mel Gorman Cc: Andrew Morton , Vlastimil Babka , Michal Hocko , Oscar Salvador , Yuanxi Liu , David Hildenbrand , Matthew Wilcox , Linux-MM , LKML Subject: Re: [PATCH] mm: page_alloc: Skip regions with hugetlbfs pages when allocating 1G pages In-Reply-To: <20230414141429.pwgieuwluxwez3rj@techsingularity.net> References: <20230414141429.pwgieuwluxwez3rj@techsingularity.net> User-Agent: Roundcube Webmail Message-ID: <253c6362834bf3c9deea94cfc7741920@suse.de> X-Sender: osalvador@suse.de Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit 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,URIBL_BLOCKED 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 2023-04-14 16:14, Mel Gorman wrote: > A bug was reported by Yuanxi Liu where allocating 1G pages at runtime > is > taking an excessive amount of time for large amounts of memory. Further > testing allocating huge pages that the cost is linear i.e. if > allocating > 1G pages in batches of 10 then the time to allocate nr_hugepages from > 10->20->30->etc increases linearly even though 10 pages are allocated > at > each step. Profiles indicated that much of the time is spent checking > the > validity within already existing huge pages and then attempting a > migration > that fails after isolating the range, draining pages and a whole lot of > other useless work. > > Commit eb14d4eefdc4 ("mm,page_alloc: drop unnecessary checks from > pfn_range_valid_contig") removed two checks, one which ignored huge > pages > for contiguous allocations as huge pages can sometimes migrate. While > there may be value on migrating a 2M page to satisfy a 1G allocation, > it's > potentially expensive if the 1G allocation fails and it's pointless to > try moving a 1G page for a new 1G allocation or scan the tail pages for > valid PFNs. > > Reintroduce the PageHuge check and assume any contiguous region with > hugetlbfs pages is unsuitable for a new 1G allocation. > > The hpagealloc test allocates huge pages in batches and reports the > average latency per page over time. This test happens just after boot > when > fragmentation is not an issue. Units are in milliseconds. > ... > > BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=217022 > Fixes: eb14d4eefdc4 ("mm,page_alloc: drop unnecessary checks from > pfn_range_valid_contig") > Reported-by: Yuanxi Liu > Signed-off-by: Mel Gorman Reviewed-by: Oscar Salvador Thanks Mel! -- Oscar Salvador SUSE Labs