Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp261916pxp; Wed, 16 Mar 2022 05:25:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxf/qvkAwTJxddtT5jo81B8G7ArYzCMZmhBgylQHGovhaVfqZXjlIawu+Ml3htnx66zDdAv X-Received: by 2002:a63:8948:0:b0:37f:f087:9cac with SMTP id v69-20020a638948000000b0037ff0879cacmr28123387pgd.120.1647433527624; Wed, 16 Mar 2022 05:25:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647433527; cv=none; d=google.com; s=arc-20160816; b=b/W0G7mZsjqdXmgrmFlSY9Xa9HPemlUhipwQpogag9Gfy9ZAU4Javc+JeM3mozFg4b 00KVk0VbGQ2fRCCwOOTUaANW1oqJtyPuN8pXdKzDtSkYxmmKn4SdcWO1znz4uwrJIhgB S+02ZKF9NKC+vR5zOQXa/da++MxWS73mHYyRdUqq44QIfuo4J4hD4AI+WENomU69dEL8 3aoSyXes/5Qaw2g4faf/emW8pRslmMnS7OwfcUt0OGoq57SQE4DwXuslrrBpU5oWyzoY eZxbzBFONjj1pY85D1k1XPBv9AN92164cc2tmsVdMpvvK0jGqgJSsApB9CTt9SFV4kMj GElg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=EQCRSWelut5GQkjvuHZWtNAKxrEn7VK6EBlg1Dlc1RA=; b=XlcP7Kdsax67EESXg9OE1z+TTExTPML6gUZ7fl64qvDaDGo0+bIF13alj0b/Jw+9Zp wEza7X3zd1a2xD3ZOOVRUbx4gWFpjCUMNyYAzeNZMDi9va6vqdfHo6AIwb0mRnLdy7ee SliCW0bFYTFU0eV0AL1wippcX6ecKcZQ3BCLZKEogCAO7Ih/qwlqfMpkkML4+zShmRbI SxlONV8t1KhFXlP9Wq6j/C5kjAcq445cD2uFMS88Kzs4D+JhRwSwZ4eSLOJhWC7hgJMS JPZgJbRUTBok6R/uQUxN3WIZHSUiTjHG+VT7Q2Kuf3eUNRCBgxS7eRxLgNP36IOGkoeN Ml5g== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a7-20020a170902900700b00151831fe79bsi1522217plp.601.2022.03.16.05.25.07; Wed, 16 Mar 2022 05:25:27 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237261AbiCNKCI (ORCPT + 99 others); Mon, 14 Mar 2022 06:02:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59272 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232273AbiCNKCC (ORCPT ); Mon, 14 Mar 2022 06:02:02 -0400 Received: from outbound-smtp39.blacknight.com (outbound-smtp39.blacknight.com [46.22.139.222]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3AC9019C28 for ; Mon, 14 Mar 2022 03:00:50 -0700 (PDT) Received: from mail.blacknight.com (pemlinmail05.blacknight.ie [81.17.254.26]) by outbound-smtp39.blacknight.com (Postfix) with ESMTPS id A91DC16E4 for ; Mon, 14 Mar 2022 10:00:48 +0000 (GMT) Received: (qmail 27288 invoked from network); 14 Mar 2022 10:00:48 -0000 Received: from unknown (HELO techsingularity.net) (mgorman@techsingularity.net@[84.203.17.223]) by 81.17.254.9 with ESMTPSA (AES256-SHA encrypted, authenticated); 14 Mar 2022 10:00:48 -0000 Date: Mon, 14 Mar 2022 10:00:46 +0000 From: Mel Gorman To: Eric Dumazet Cc: Andrew Morton , linux-kernel , linux-mm , Eric Dumazet , Matthew Wilcox , Shakeel Butt , David Rientjes , Vlastimil Babka , Michal Hocko , Wei Xu , Greg Thelen , Hugh Dickins Subject: Re: [PATCH] mm/page_alloc: call check_pcp_refill() while zone spinlock is not held Message-ID: <20220314100046.GM15701@techsingularity.net> References: <20220313232547.3843690-1-eric.dumazet@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline In-Reply-To: <20220313232547.3843690-1-eric.dumazet@gmail.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW, 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 Sun, Mar 13, 2022 at 04:25:47PM -0700, Eric Dumazet wrote: > From: Eric Dumazet > > check_pcp_refill() is used from rmqueue_bulk() while zone spinlock > is held. > > This used to be fine because check_pcp_refill() was testing only the > head page, while its 'struct page' was very hot in the cpu caches. > > With ("mm/page_alloc: check high-order pages for corruption during PCP > operations") check_pcp_refill() will add latencies for high order pages. > > We can defer the calls to check_pcp_refill() after the zone > spinlock has been released. > > Signed-off-by: Eric Dumazet I'm not a major fan. While this reduces the lock hold times, it adds another list walk which may make the overall operation more expensive which is probably a net loss given that the cold struct pages are still accessed. The lower lock hold times applies to high-order allocations which are either THPs or SLAB refills. THP can be expensive anyway depending on whether compaction had to be used and SLAB refills do not necessarily occur for every SLAB allocation (although it is likely much more common for network intensive workloads). This means that the patch may be helping the uncommon case (high order alloc) at the cost of the common case (order-0 alloc). Because this incurs a second list walk cost to the common case, I think the changelog would need justification that it does not hurt common paths and that the lock hold reduction times make a meaningful difference. -- Mel Gorman SUSE Labs