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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id D242CC433F5 for ; Tue, 1 Feb 2022 12:04:05 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4BC706B0107; Tue, 1 Feb 2022 07:04:05 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 46B696B010A; Tue, 1 Feb 2022 07:04:05 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3820C6B0111; Tue, 1 Feb 2022 07:04:05 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0212.hostedemail.com [216.40.44.212]) by kanga.kvack.org (Postfix) with ESMTP id 298BA6B0107 for ; Tue, 1 Feb 2022 07:04:05 -0500 (EST) Received: from smtpin15.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id DE805180991FF for ; Tue, 1 Feb 2022 12:04:04 +0000 (UTC) X-FDA: 79094077608.15.77F4826 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by imf24.hostedemail.com (Postfix) with ESMTP id 669E4180005 for ; Tue, 1 Feb 2022 12:04:04 +0000 (UTC) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 0DD14210F2; Tue, 1 Feb 2022 12:04:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1643717043; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=hrN9xPUO5EN6dEbkbWJxE1GMk/3AOPqzgOQALBnBLWQ=; b=oaBH06F3xwJLF4qBgQCvmjfMMK6tPM6NWcnZ9usdz2K1TZcbhSKMCQ8fuJp5hkqzrXGmtN aFjVM5efImZaoO24xax017Ow0cuV+W4i+wPJIJeP+vwnpwD1FaG/3ljfO6pYchd6D+2QKR yhFhjJfXgq6MIzYs5NAaVUHBIMCento= Received: from suse.cz (unknown [10.100.201.86]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id EB120A3B84; Tue, 1 Feb 2022 12:04:02 +0000 (UTC) Date: Tue, 1 Feb 2022 13:04:02 +0100 From: Michal Hocko To: Sebastian Andrzej Siewior Cc: cgroups@vger.kernel.org, linux-mm@kvack.org, Andrew Morton , Johannes Weiner , Michal =?iso-8859-1?Q?Koutn=FD?= , Peter Zijlstra , Thomas Gleixner , Vladimir Davydov , Waiman Long Subject: Re: [PATCH 3/4] mm/memcg: Add a local_lock_t for IRQ and TASK object. Message-ID: References: <20220125164337.2071854-1-bigeasy@linutronix.de> <20220125164337.2071854-4-bigeasy@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspamd-Queue-Id: 669E4180005 X-Rspam-User: nil Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b=oaBH06F3; dmarc=pass (policy=quarantine) header.from=suse.com; spf=pass (imf24.hostedemail.com: domain of mhocko@suse.com designates 195.135.220.28 as permitted sender) smtp.mailfrom=mhocko@suse.com X-Stat-Signature: rg35esa9bj56dabeun9x3p9e5ezst9hs X-Rspamd-Server: rspam08 X-HE-Tag: 1643717044-286338 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Thu 27-01-22 12:53:40, Sebastian Andrzej Siewior wrote: > On 2022-01-26 16:20:36 [+0100], Michal Hocko wrote: > > I do not see any obvious problem with this patch. The code is ugly as > > hell, though, but a large part of that is because of the weird locking > > scheme we already have. I've had a look at 559271146efc ("mm/memcg: > > optimize user context object stock access") and while I agree that it > > makes sense to optimize for user context I do not really see any numbers > > justifying the awkward locking scheme. Is this complexity really worth > > it? > > >From https://https://lkml.kernel.org/r/.kernel.org/all/YdX+INO9gQje6d0S@linutronix.de/: > > | Sandy Bridge Haswell Skylake AMD-A8 7100 Zen2 ARM64 > |PREEMPT 5,123,896,822 5,215,055,226 5,077,611,590 6,012,287,874 6,234,674,489 20,000,000,100 > |IRQ 7,494,119,638 6,810,367,629 10,620,130,377 4,178,546,086 4,898,076,012 13,538,461,925 > > basically if PREEMPT < IRQ then preempt_disable() + enable() was cheaper > than local_irq_save() + restore(). > > | Sandy Bridge > | SERVER OPT SERVER NO-OPT PREEMPT OPT PREEMPT NO-OPT > | ALLOC/FREE 8,519,295,176 9,051,200,652 10,627,431,395 11,198,189,843 > | SD 5,309,768 29,253,976 129,102,317 40,681,909 > | ALLOC/FREE BH 9,996,704,330 8,927,026,031 11,680,149,900 11,139,356,465 > | SD 38,237,534 72,913,120 23,626,932 116,413,331 > > OPT is code as-is while "NO-OPT" is with the following patch which > disables the optimisation (so it should be a revert of the optimisation > commit). > > ALLOC/FREE is kfree(kmalloc()). > ALLOC/FREE BH is the same but in_interrupt() reported true. > The numbers are are time needed in ns for 100,000,000 iterations of the > free+alloc. SD is standard deviation. > I also let the test run on a Zen2 box: > > | SERVER OPT SERVER NO-OPT PREEMPT OPT PREEMPT NO-OPT > | ALLOC/FREE 8,126,735,313 8,751,307,383 9,822,927,142 10,045,105,425 > | SD 100,806,471 87,234,047 55,170,179 25,832,386 > | ALLOC/FREE BH 9,197,455,885 8,394,337,053 10,671,227,095 9,904,954,934 > | SD 155,223,919 57,800,997 47,529,496 105,260,566 > > Is this what you asked for? Thanks! This gives us some picture from the microbenchmark POV. I was more interested in some real life representative benchmarks. In other words does the optimization from Weiman make any visible difference for any real life workload? Sorry, I know that this all is not really related to your work but if the original optimization is solely based on artificial benchmarks then I would rather drop it and also make your RT patchset easier. -- Michal Hocko SUSE Labs