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 479CBC02182 for ; Thu, 23 Jan 2025 03:33:17 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B29CD6B0085; Wed, 22 Jan 2025 22:33:16 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id AD9566B0088; Wed, 22 Jan 2025 22:33:16 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9C81E6B0089; Wed, 22 Jan 2025 22:33:16 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 79B5C6B0085 for ; Wed, 22 Jan 2025 22:33:16 -0500 (EST) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 271EF1A09CD for ; Thu, 23 Jan 2025 03:33:16 +0000 (UTC) X-FDA: 83037295992.16.7E9CCF3 Received: from out30-131.freemail.mail.aliyun.com (out30-131.freemail.mail.aliyun.com [115.124.30.131]) by imf07.hostedemail.com (Postfix) with ESMTP id 715FE40007 for ; Thu, 23 Jan 2025 03:33:13 +0000 (UTC) Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=linux.alibaba.com header.s=default header.b=sxw0siYC; spf=pass (imf07.hostedemail.com: domain of ying.huang@linux.alibaba.com designates 115.124.30.131 as permitted sender) smtp.mailfrom=ying.huang@linux.alibaba.com; dmarc=pass (policy=none) header.from=linux.alibaba.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1737603194; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=2lsDPWvDtMfLfMIV7hWLp0tfTWnTTnVOPgkf/bqRyXk=; b=7Xg0IgTlu0Nszq+c7gZbhYfMiWSNIR85xQtaxTWs8i7RHBoj0cN5k+IrDvSzrtf9Lg/QQW bPKoNy9TI9B8O7P0qitpql7ISWVDqtc0y5Msu+MEalGaWED+LYDfrAUlFSAkzS8iq7x7NM uMONFI0Ww3FPbE8YywHm5odDIyGufyk= ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=pass header.d=linux.alibaba.com header.s=default header.b=sxw0siYC; spf=pass (imf07.hostedemail.com: domain of ying.huang@linux.alibaba.com designates 115.124.30.131 as permitted sender) smtp.mailfrom=ying.huang@linux.alibaba.com; dmarc=pass (policy=none) header.from=linux.alibaba.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1737603194; a=rsa-sha256; cv=none; b=BSmmwBr+A505yRZs6TfMLisRmR0oiJTlf2zk93SQDhZq/nUTmVhZNa7c65KvE+J0sjsoOR vPXaEBW7kHn7QssQWKiJ6R0pTxLa1ForDHZ2rME30LtWTiqp5jtJbj1/pdyKqsx+PDxNC8 WVtVFy4NoMUzVqKgaYB18dc2bCK+dfM= DKIM-Signature:v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1737603190; h=From:To:Subject:Date:Message-ID:MIME-Version:Content-Type; bh=2lsDPWvDtMfLfMIV7hWLp0tfTWnTTnVOPgkf/bqRyXk=; b=sxw0siYCDy62cS8jCh02Z+8h5FxoplY8Fuk8X5L7ZOTnUpwJVHw9dDQecL0pkP31eWypX4RJQywYqHhdLRxY2TVlsy0LIsIzx9psv9Eggl+FOdT6YdVY9SaUs0uwWv0jzmymgml21GPE64Gh01eJZ4szdjJSFz1tAyfy6XqxwKU= Received: from DESKTOP-5N7EMDA(mailfrom:ying.huang@linux.alibaba.com fp:SMTPD_---0WOAEWoR_1737603157 cluster:ay36) by smtp.aliyun-inc.com; Thu, 23 Jan 2025 11:33:08 +0800 From: "Huang, Ying" To: Joshua Hahn Cc: Gregory Price , hyeonggon.yoo@sk.com, rafael@kernel.org, lenb@kernel.org, gregkh@linuxfoundation.org, akpm@linux-foundation.org, honggyu.kim@sk.com, rakie.kim@sk.com, dan.j.williams@intel.com, Jonathan.Cameron@huawei.com, dave.jiang@intel.com, horen.chuang@linux.dev, hannes@cmpxchg.org, linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, linux-mm@kvack.org, kernel-team@meta.com Subject: Re: [PATCH v3] Weighted interleave auto-tuning In-Reply-To: <20250122155935.1282897-1-joshua.hahnjy@gmail.com> (Joshua Hahn's message of "Wed, 22 Jan 2025 07:59:34 -0800") References: <20250122155935.1282897-1-joshua.hahnjy@gmail.com> Date: Thu, 23 Jan 2025 11:32:37 +0800 Message-ID: <8734hakxwq.fsf@DESKTOP-5N7EMDA> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=ascii X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 715FE40007 X-Stat-Signature: mwoon7sc3niej344hnx7icjedkayespt X-Rspam-User: X-HE-Tag: 1737603193-525982 X-HE-Meta: U2FsdGVkX1+P0dkVx7d0JDOoiL5LjlehL1IoVebBx1ehi2RhAknmp0OQaXMBNMyiH8VLq3rOQfhSSyZKndVs/dIr8EsAut66vjDfY1X9g/RBX2o8I11E4D5I0aY8865HGz7qLzxndK1sxGVnN8qNrfBZ82xCJfzOeq2v2K+G4MTIOCfMoUTnbCWtEk1+l55W6VfPN/U4YuoKELDgE4Cze888HJzJvV7gbjw+IiXo3vVZ6NDg7U8T/LM3GYLbZE66o51i4HyU2n1gpaCK7nFkj7c33+2StfFRAAt7w4xgGB/xqtUCfg1UfFlWQXBUsfImxUISXHxGEoxlR7Rcvp1y7h4KfTeMfi56Bmsd4Y0hbxWaC2bBV4IWZH5HaF6xJ7S3s10PF9SJ0urPWb5bJz7VgPI9zEdHQBGcYeiub8VfXSDb+OJdntEHO3aH8w9/dKV8eKeq/8vjwFvZDgNCRGgI9y6di08bkgfnaEFuEz2obMZPlE3kJLuBg5MCePyCy/A6jFVX2YDAIBgHlbcZ8zGB1UHPdblHJgz7uuhWH+lVVrnqJVjOx2R6n3N1p1/jSadbWFkxQ2rJT+smZfeCxCfiBptJBs1v+MD7UEkgLAjsOlkdpBJRiepFbCD5DxHDfvqR2DlOqymDjqVYS/rizf9ASHCvZ4UbsA1sATX5f+PfXOfOghfzmlZa4LjC/ULlzCTnBkVE4RuMjDNrKS3/zYqYFBhQP92+uWI2YXGtcnATXypcxxWoqRGisVCtROTaVPu9Ov/mMy3896RvYYa6Qj/OF9ElreUEbwtawoa1eJEarO/3Ig7g/PV7WfzSeJhkUVLhHh5K2c3DYq/ajCVay/D9D60q1q9O2Yz+ErCP9DJp4Of1PwmbTR08x+zMSYiWq8QvVWGoHqre8vVUinWVCYYaGBETOe8rmS+1FU5gtutAGEt285PvfUQZFztTFffWa2NURysTfAy8i4jTI+NK2Lj xfiOMdBl Bkud4ATdtvR7INdoM0VeLwqLmPXunuVi88Gydkm7nMyVOxshxZyDrVoHea8KMNtWbZvdtDDAkTB1HyR6Pz4cok8ZgwiMFVH6X4KqlYNlHRbusIVbF/7NKfRywF0J4GQoQcPPfusI3fpX7Jcj4N2gPzfJaJPW5EuwS6Xbv5PHHVoyXC4bVZIiB11s5hwcoIkoAdWA9C2L4rYF1si5zWXpzedwofwLkUgpiLItD+rDGA7GM0j8D3UiV2CTJWNVuMfhL69iuuLw4/bHahLTuJ0A8lphe7G2jh2EokEvjcOGxAjcCD1/VUPuasjdVuu32WDtBbkJQaSEisHqE5Qc= 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: List-Subscribe: List-Unsubscribe: Joshua Hahn writes: > On Wed, 22 Jan 2025 09:37:20 +0800 "Huang, Ying" wrote: > > Hi Gregory and Ying, thank you both for your insights! > > [...snip...] > >> >> I still prefer to use 2 iw_table, one is for default, the other is for >> >> manual. The default one will be used if the manual one is NULL. Both >> >> are protected by RCU. The default one can be updated upon hotplug >> >> blindly. This makes the whole model easier to be understood IMHO. >> > `cat auto node0 node1` -> `true 5 1` >> > and you do >> > echo 0 > auto > > I think that when initially developing this patch, this was the intent > that I had as well (in the v1 of this RFC patch, there was an iw_table > and a separate default_iw_table). However, I think that the ideas of > having a "default" and "manual" table made less sense over time, given > that they behaved more like a "default" and "visible" table instead. > That is, the visible layer is directly manipulable by the user, but > does not necessarily only contain manually-set values; rather, most of > the time, it probably still has a lot of auto-generated weights. > > I think that this analysis runs the risk of being a bit too semantically > nit-picky, but as I'll explain below, I think both the 1-layer approach > that I implemented in this RFC and the expected 2-layer behavior that > you outline below are essentially the same, functionally. In other > words, I think we agree on what the expected behavior should be : -) > We just have to agree on what presentation would make the most sense > for the user. This sounds good to me. We still need to finalize the interface, 'mode' or 'auto'. Personally, I prefer 'auto', because it's simpler. >> > what should a subsequent `cat auto node0 node1` output? >> > >> > `false 5 1` >> > or >> > `false 1 1` >> >> IMO, it should be >> >> `false 5 1` >> >> That is, we copy auto-generated weights to manual weights atomically and >> use it. >> >> > Then lets say we do >> > echo 7 > node0 >> >> Now, `cat auto node0 node1` outputs, >> >> `false 7 1` >> >> That is, we delete manual weights and use the auto-generated ones. >> >> > what should >> > echo true > auto >> > result in? >> > >> > `true 5 1` >> > or >> > `true 7 1` >> >> It should be >> >> `true 5 1` > > I see, so I think we actually agree on what the behavior for this is. > Then there is no real "hidden state", it's either just using the > default weights, or turning that off and being able to edit the > states. > >> > The current code makes sure that when you switch modes from auto >> > to manual, it inherits the current state - instead of there being >> > some hidden state that suddenly takes precedence. >> >> I think that we can do that with two weight arrays. >> >> > So I prefer to just have one IW array and no hidden state. >> >> Then, when we switch from manual to auto mode, where to find >> auto-generated weights? Re-calculate them? > > Even in manual mode, incoming bandwidth data is continuously stored. > This way, when a user does decide to switch back to auto mode later, > the system doesn't have to retrieve the bandwidth data all over again. > As for the auto-generated weights, they are re-calculated based solely > on the bandwidth data available. (I will note that re-calculating > the weights are very quick, see reduce_interleave_weights) > > Based on your description of the expected behavior, everything you > listed out is actually what currently happens in the one-layer system. > Switching from auto --> manual inherits the auto-generated weights, and > switching from manual --> auto wipes all previous user-stored data. > > At this point, I think that I am happy with either option. I wrote and > re-wrote this a bunch of times, and came to the conclusion that now > that we agree on the behavior of the interface, I have no strong > opinion on whether we have a "hidden" default layer or a phantom > default layer that is just generated every time a user needs it : -) > > Please let me know if I missed anything as well! Thank you all for > your continued feedback and interest! Have a great day, I see. You cache the nodes bandwidth instead of default weights. That works. I am fine with either way too. --- Best Regards, Huang, Ying