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 ED25DC02181 for ; Wed, 22 Jan 2025 15:59:41 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 576D9280003; Wed, 22 Jan 2025 10:59:41 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 4FECA280001; Wed, 22 Jan 2025 10:59:41 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 378E8280003; Wed, 22 Jan 2025 10:59:41 -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 14773280001 for ; Wed, 22 Jan 2025 10:59:41 -0500 (EST) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id B1BC2120334 for ; Wed, 22 Jan 2025 15:59:40 +0000 (UTC) X-FDA: 83035548120.21.E7C786F Received: from mail-yb1-f181.google.com (mail-yb1-f181.google.com [209.85.219.181]) by imf23.hostedemail.com (Postfix) with ESMTP id B6648140019 for ; Wed, 22 Jan 2025 15:59:38 +0000 (UTC) Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=knyEwX8O; spf=pass (imf23.hostedemail.com: domain of joshua.hahnjy@gmail.com designates 209.85.219.181 as permitted sender) smtp.mailfrom=joshua.hahnjy@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1737561578; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=KVFr/Kd+y56MHCAVrQFvOJkjt8uO/hZsG3DvF4rttc4=; b=1is5wHF+OQOSTdhm0TgmeQ1AVtwNjDTsT90R/v/gQL2cgAOuXtjiVQLupHp6LgzDINhIi6 RhGssWIHodP8EDCPeYyk7cN+Unze7lNUMIkuGHV6isTIt6XmFFKbhRW/Osno4RtrU8uskg zO8drDZ6eo/Klioc7PbV0AY1nnjJ2q0= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1737561578; a=rsa-sha256; cv=none; b=3ANMkXIsoKZAV7q4NGw8ncjDO7KPEs5eqkbhxPqS3txgYo1JdeJUSUuM5aZp+2H4k/MCeW 1dqf/LfOdeeQJ//2GY2VLlfWiIlD83qRU353BbqLyueOmscAqbc9EvNIRajIEBR+ibBKgQ fXm+aBcnai99Amv8lPjfTQw4dllR47w= ARC-Authentication-Results: i=1; imf23.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=knyEwX8O; spf=pass (imf23.hostedemail.com: domain of joshua.hahnjy@gmail.com designates 209.85.219.181 as permitted sender) smtp.mailfrom=joshua.hahnjy@gmail.com; dmarc=pass (policy=none) header.from=gmail.com Received: by mail-yb1-f181.google.com with SMTP id 3f1490d57ef6-e3978c00a5aso11058888276.1 for ; Wed, 22 Jan 2025 07:59:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1737561577; x=1738166377; darn=kvack.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=KVFr/Kd+y56MHCAVrQFvOJkjt8uO/hZsG3DvF4rttc4=; b=knyEwX8OzWOsi9mVCMljsWHq7jVWDFDkz1KX81xY6aeEfLUsnP/dsWDSXVHi5KW4Tp o9/sbgn2njEUj1TmGJM69BcHywhjXcC/LEyJ0hYUfq/Wnt09c3yIBL3DckArX8Bi9kAz sE3t1qs5c6o6XSJN8D1V0ZCoFNdHu6tQ0sqISFs81LHLZye7q3FxxWX5J/4kS5bzKCYW UZ1h9CDC0du0j/Hjmdix7UN9hxZbdpnoDupODBKhxd3ZjYvDmwiz/hIquxvaIecB6ICL lZWn28wdJzqHlZH5v5M+zcVSVvQ8zHiFkPm+hBpfG4MtFPsPc8nGrPg4J9wu4C7VbBFk RGTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737561577; x=1738166377; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=KVFr/Kd+y56MHCAVrQFvOJkjt8uO/hZsG3DvF4rttc4=; b=fpbKYDDA3ZUHwyfl+/R7nFfTx5ZXhoWmlLa+VheCNs2oRpNCS0xu/NbusfZwwaQgeM QT/H3UdJO0DcI7rJDb22dpi631gy7WAJYmcOiMnt7rs8236yav0IpH/CANkbf54uBFL/ O9qG+6iYjGr0OO8by2fWynGZlA3Jk/gA+yuN3VLtLZKUkLUJ2b7yp79LAkHaofch5y/o Nb26N44z2yaIgmVlzYepPOdVWkqmH5OELhzJQ9oCyAN/Qilq8pkueyvuaO1X/EM76LjO zckLfgarUB9jOGI1ZG+jd0P57wfdGY9rsQSsJHIa1AS+qmZ6QZ+e0jvfxsBSBA0GIorO MrQw== X-Forwarded-Encrypted: i=1; AJvYcCU/3LRQBqMV3ejKBNO+eEnE2uaJHQxa2PFQE6UlxDtRyfIqhBum0CPUrU6/lWtSEDMaPIpv0AWUjg==@kvack.org X-Gm-Message-State: AOJu0YwpT/5x5hYeI1M+3olBXAHtKlF9S0C6Im0r/tI+To5QgkZ7GJzV mff2Af0w0XB6d3hxEJKbDd+ryIs6iXH7SzvWMpuhuXfBsY68GkZQ X-Gm-Gg: ASbGncv4m2u7fH3IyvZZsznCQP75GOAnOHP8LDwCT1SOoh0cbxNh1ejKzRx163hhHhT +OEJxYpKEbjxqlcKE4nQ7MwHPFFVxreDAnYQ8Mh/bgjaEMrcsr0B4DW7rdbJPMx2/7e73z42xIB oZkjCsaOYDXbZSgybeuMpQI2D5eBIZiKXjfSGOuOGcB4G92KiiBk4GSeAN5zDIACW7Iwwb0wASu NdvTzGHonowYtOJWY+FaNKZ1EPML7C0f6r01aXzgk7dT04AM4oPJrqvppxaWcYHBOwa X-Google-Smtp-Source: AGHT+IEWfZo5EURfw62UUgGMK8Ad/eJOfQApkVZS8mrN7GFmmCq2u/q3+aJvOZGNF/swbGrCD6lBSQ== X-Received: by 2002:a05:690c:6812:b0:6ef:e39f:bb1 with SMTP id 00721157ae682-6f6eb905af5mr181841207b3.27.1737561577576; Wed, 22 Jan 2025 07:59:37 -0800 (PST) Received: from localhost ([2a03:2880:25ff:6::]) by smtp.gmail.com with ESMTPSA id 00721157ae682-6f6e670b187sm20665747b3.124.2025.01.22.07.59.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Jan 2025 07:59:37 -0800 (PST) From: Joshua Hahn To: "Huang, Ying" 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 Date: Wed, 22 Jan 2025 07:59:34 -0800 Message-ID: <20250122155935.1282897-1-joshua.hahnjy@gmail.com> X-Mailer: git-send-email 2.43.5 In-Reply-To: <8734hbiq7j.fsf@DESKTOP-5N7EMDA> References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Stat-Signature: 8478tduiww8nczsiyro8p4fdwsygzry4 X-Rspamd-Queue-Id: B6648140019 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1URblEAWG14WDCN6qnxS7pD/GGj7P04OvbzHm/izycQFkP+3ppUs59J0poKgaO56Fg09MWWDMtsivXjZK/G3LTzResII/b//o5oORphTkbV753zyhtt3fW/xyTfeBj9EZj5Mqy3scC4cDKOJnEdStrtdSlZHeg90djr1zbNubi6WTuvUlV8PmcrVYZW9GTUycHBDO6GG3Qv1Kc96NE6n0W8vKp986w1L4ycRIVVC+QyuvWzaBydASgLJkBK7nxIoZMpvRC/mmT9hxGvtAWEjtW2AOrDSh7qnSDkpujHbi3neIyEo6/J/G1gToHNGp3Sl3PcpFf6j4+pposKlSBZVYbf8e50iz9hC8pFO7jQSVhz557+K5tLp8P6yt0KnkHs+e5Y9AbecMcHsaUYroAQ4zw25i4Vd4HOhQI4R+jNBSjnDYCLes5Nj7D1Zwjiotdu46M+TPK/WYaT89iQ+NQ4cnuA== X-Bogosity: Ham, tests=bogofilter, spamicity=0.005615, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: 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. > > 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, Joshua