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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B3241C6498F for ; Thu, 25 Aug 2022 05:21:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233598AbiHYFVz (ORCPT ); Thu, 25 Aug 2022 01:21:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45118 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229577AbiHYFVy (ORCPT ); Thu, 25 Aug 2022 01:21:54 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4A99D9DB79; Wed, 24 Aug 2022 22:21:53 -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 A6AAB616F1; Thu, 25 Aug 2022 05:21:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 81F9BC433D6; Thu, 25 Aug 2022 05:21:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1661404912; bh=AnKrb1Ct86zWoZc2cR8mHfo305wchMKv2BEvmUehEfA=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=QundzHzoSD285RvlDevYssYd0+eBJWvLpiws5T0NJRxeZcpTf/6HAWQ6nRYpD05/L Jo7K04tJKiBzbEwarfN/+9T/St1bo6xkgoING+DmJ1b6qFnnXmAS6URsD+huaj8WI/ pC9DzwN3tmyooTXX3GJR8yBcpQ0GBO+NebpLXbTY= Date: Wed, 24 Aug 2022 22:21:50 -0700 From: Andrew Morton To: Shakeel Butt Cc: Johannes Weiner , Michal Hocko , Roman Gushchin , Muchun Song , Michal =?ISO-8859-1?Q?Koutn=FD?= , Eric Dumazet , Soheil Hassas Yeganeh , Feng Tang , Oliver Sang , lkp@lists.01.org, Cgroups , Linux MM , netdev , LKML Subject: Re: [PATCH v2 2/3] mm: page_counter: rearrange struct page_counter fields Message-Id: <20220824222150.61c516a83bfe0ecb6c9b5348@linux-foundation.org> In-Reply-To: References: <20220825000506.239406-1-shakeelb@google.com> <20220825000506.239406-3-shakeelb@google.com> <20220824173330.2a15bcda24d2c3c248bc43c7@linux-foundation.org> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.33; x86_64-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 24 Aug 2022 21:41:42 -0700 Shakeel Butt wrote: > > Did you evaluate the effects of using a per-cpu counter of some form? > > Do you mean per-cpu counter for usage or something else? percpu_counter, perhaps. Or some hand-rolled thing if that's more suitable. > The usage > needs to be compared against the limits and accumulating per-cpu is > costly particularly on larger machines, Well, there are tricks one can play. For example, only run __percpu_counter_sum() when `usage' is close to its limit. I'd suggest flinging together a prototype which simply uses percpu_counter_read() all the time. If the performance testing results are sufficiently promising, then look into the accuracy issues.