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 D71E4C3ABC9 for ; Sat, 10 May 2025 18:51:56 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8AD2C6B00C8; Sat, 10 May 2025 14:51:54 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 85BB46B00C9; Sat, 10 May 2025 14:51:54 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 722666B00CA; Sat, 10 May 2025 14:51:54 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 54FE46B00C8 for ; Sat, 10 May 2025 14:51:54 -0400 (EDT) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 11A05160B27 for ; Sat, 10 May 2025 18:51:55 +0000 (UTC) X-FDA: 83427892590.11.56CD3A8 Received: from mail-yb1-f172.google.com (mail-yb1-f172.google.com [209.85.219.172]) by imf01.hostedemail.com (Postfix) with ESMTP id 5CBE440008 for ; Sat, 10 May 2025 18:51:53 +0000 (UTC) Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=i5mUJ7Ab; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf01.hostedemail.com: domain of joshua.hahnjy@gmail.com designates 209.85.219.172 as permitted sender) smtp.mailfrom=joshua.hahnjy@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1746903113; a=rsa-sha256; cv=none; b=drhP/Z2TdbaViYf8XJWIinI6DcUplPuA6Xt0SV8wIphYuDCmAZsQUkB79l2cn97mvL0JFX QnmnEw9rwWLJSATvHW2waYkVHSk6PBO+KuuY+VXGQCQsIeLboDtyk0yZAgMC5EEQH0z6OQ CCCgUQqE0roqQmIaVw7wOT+A+vif7Ls= ARC-Authentication-Results: i=1; imf01.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=i5mUJ7Ab; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf01.hostedemail.com: domain of joshua.hahnjy@gmail.com designates 209.85.219.172 as permitted sender) smtp.mailfrom=joshua.hahnjy@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1746903113; 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=ajISBZKVOwFL0mVE+DS2D0tb1au8A8XUlLnEI2/dhuU=; b=pbUgqxfNSb2xJEEQED0HQhZjugVu0BKa0mitUB/CJwXaIpCl/eeOuiLQejsC84Qocert3+ gcM3IRhJFbG40Stdi8xQQtBnN5L2JQ11FxFMs9CFxrMno1xsrfengmD64kG6JjsYSvbuTT HsDw94SO9fADsDxXWiU/Frb/GuI9Rr0= Received: by mail-yb1-f172.google.com with SMTP id 3f1490d57ef6-e728cd7150dso2644098276.3 for ; Sat, 10 May 2025 11:51:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1746903112; x=1747507912; 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=ajISBZKVOwFL0mVE+DS2D0tb1au8A8XUlLnEI2/dhuU=; b=i5mUJ7Abgpy60IssOgIXko555GdFJ081xA/oTecwPKjkJvywXXshU9WUfNtBv+4rpl /S10Oo5eoNEYoq+PPv2XiisNGjvBb8WjgS3/FHAaYBCuuON223+onMcgV7ze04o8jumx R6ZWSCE0oSaANc3cZneFDquzYcz3zmdrsSF+wDBE0jNumdpKI+9FXqXpz+P6sLIlbOHL a6oTZgG/hfcn9Xu6Cu8nYDtC/teQNLjKBRAirgV0rospUUbRRHI56gKGFXwhXJcnB/rd TCj20wqgmoPNq5o3bNODEi2XWASUsBN85Xc2THlN4IXeD23QieUhqxPazy9S0vNIlIJx g/GQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1746903112; x=1747507912; 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=ajISBZKVOwFL0mVE+DS2D0tb1au8A8XUlLnEI2/dhuU=; b=qmgGq87BkE0qE50DtL+dQ7bvOoHVrz6VRmf4U1MM1Pzrc2ZFj/5/JltiQlQiqAeVQF nyhPbNAKzspq/mJ4p921G7S6vY/bt4XUZTtluN4MxtrBvkv7Oq4tPpDskHrlPMDOMd5l +YTiAsyKtcIhAd1C3F4s5Y1OPJQktW/nLFaCa2zfr33a3PLxmYySQSlx/7a3UBL+wH6F lWtjK19joe/BtuQ15w/2K+xhPcuaIo3QJheS1YtSAjNFSOHBawZoSZZH3oxmrWDI6fNn 0y6DEOKEtGTds+yHaDF9nkuh4tY1DDn9jOlMcb4vf65z6H+Fzuh6RSQ/uxE5kAY8BdMd kHyw== X-Forwarded-Encrypted: i=1; AJvYcCXTCYTlS5BtCwnFeC/YEItjC3t41oHV8cbTUkwpobwuEJHFjiWqqjgViVO7qGdDMqnPo1Qor3sD1g==@kvack.org X-Gm-Message-State: AOJu0YzF0k2iM+neNu+B9Wjc2n6AZqBpEwz3N2mzWbfjRNx2wu+nJCeP +BMH2FWiM543qPhFy8vzixxHTglkB70jKhzug6Pem59t0Mn4SRpO X-Gm-Gg: ASbGncu0gT6COOCnZYwbjl5fEOT1hZKyjJv4EDLcuuax6lwWge2jyB0WcVwhPypgdmP ECXAGQkdrq+T9ToXVu1p3JUeuDnHRjSHGkO5LUP3mnhBDf9QfsbODusPlUXOsjhA1PfUOQMqqh8 +huvl9P9+z/LRIP6LxWBx2GP60dRw+UvuTWyzZ6pfBuEC/ts0lwHvOS4RINomAgA1Ayv0GPwTHE mxRCBI1CtAAvgPFqoVz5TRKJwSUyO0WuzDRbJRyy0XIMwYD7HDPQEODUg8xt/Npd35h3zwQqR1q ynUUasqglYaSqWqVHoVKXOU0XSapL6pbSh0nejgJpP72NfWCUQ== X-Google-Smtp-Source: AGHT+IGhodSte6+0hre33mKZAplqwN7/ZYX5FkaNb/0QiiejR145pODTSd2jiNxbF9YyFT1jpNULRw== X-Received: by 2002:a05:6902:2601:b0:e78:ed64:c495 with SMTP id 3f1490d57ef6-e78fdb83f7dmr10370707276.6.1746903112283; Sat, 10 May 2025 11:51:52 -0700 (PDT) Received: from localhost ([2a03:2880:25ff:2::]) by smtp.gmail.com with ESMTPSA id 3f1490d57ef6-e78fd651a24sm1230871276.38.2025.05.10.11.51.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 10 May 2025 11:51:51 -0700 (PDT) From: Joshua Hahn To: "Huang, Ying" Cc: gourry@gourry.net, honggyu.kim@sk.com, yunjeong.mun@sk.com, gregkh@linuxfoundation.org, rafael@kernel.org, lenb@kernel.org, dan.j.williams@intel.com, Jonathan.Cameron@huawei.com, dave.jiang@intel.com, horen.chuang@linux.dev, hannes@cmpxchg.org, osalvador@suse.de, linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, linux-mm@kvack.org, kernel-team@meta.com Subject: Re: [PATCH v8] mm/mempolicy: Weighted Interleave Auto-tuning Date: Sat, 10 May 2025 11:51:50 -0700 Message-ID: <20250510185150.4078843-1-joshua.hahnjy@gmail.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: <87h61t11gz.fsf@DESKTOP-5N7EMDA> References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Stat-Signature: 8h4q6kg19sp5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j3abd+TX hsFSZqBAlwK8iRQZA1lSgjSD5ReUUSvj0DEfQTTHa9z1VMjGljPIErjDgY4ycNLpCbHTI0CFuWOtQ5QIoeCLZwBCtTe418eF7jzzo 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: On Sat, 10 May 2025 13:25:32 +0800 "Huang, Ying" wrote: Hi Ying, Thank you for reviewing my patch, as always! > Hi, Joshua, > > Thank you for updated version! And sorry for late reply. > > Joshua Hahn writes: [...snip...] > > diff --git a/Documentation/ABI/testing/sysfs-kernel-mm-mempolicy-weighted-interleave b/Documentation/ABI/testing/sysfs-kernel-mm-mempolicy-weighted-interleave > > index 0b7972de04e9..ec13382c606f 100644 > > --- a/Documentation/ABI/testing/sysfs-kernel-mm-mempolicy-weighted-interleave > > +++ b/Documentation/ABI/testing/sysfs-kernel-mm-mempolicy-weighted-interleave > > @@ -20,6 +20,35 @@ Description: Weight configuration interface for nodeN > > Minimum weight: 1 > > Maximum weight: 255 > > > > - Writing an empty string or `0` will reset the weight to the > > - system default. The system default may be set by the kernel > > - or drivers at boot or during hotplug events. > > + Writing invalid values (i.e. any values not in [1,255], > > + empty string, ...) will return -EINVAL. > > + > > + Changing the weight to a valid value will automatically > > + update the system to manual mode as well. > > s/update/switch/ ? > > But my English is poor, please keep your version if you think that it's > better. I have no particular preference here, whatever will make it easiest for the users to understand what is happening. I'll take your suggestion! [...snip...] > > +/* > > + * A null weighted_interleave_state is interpted as having .mode = "auto", > > + * and .iw_table is interpreted as an array of 1s with length nr_node_ids. > > + */ > > Better to move the comments to above "wi_state" definition? > > > +struct weighted_interleave_state { > > + bool mode_auto; > > + u8 iw_table[]; > > +}; > > + > > Why do you put the type definition in mempolicy.h instead of > mempolicy.c? I don't find other users except mempolicy.c. Good point, I'll move the definition to mempolicy.c and move the comment to the wi_state definition as well. [...snip...] > > @@ -3450,31 +3555,104 @@ static ssize_t node_show(struct kobject *kobj, struct kobj_attribute *attr, > > static ssize_t node_store(struct kobject *kobj, struct kobj_attribute *attr, > > const char *buf, size_t count) > > { > > + struct weighted_interleave_state *new_wi_state, *old_wi_state = NULL; > > struct iw_node_attr *node_attr; > > - u8 *new; > > - u8 *old; > > u8 weight = 0; > > + int i; > > > > node_attr = container_of(attr, struct iw_node_attr, kobj_attr); > > if (count == 0 || sysfs_streq(buf, "")) > > weight = 0; > > According to revised ABI, we should return -EINVAL here? Great catch, I completely ignored the ABI description that I wrote... I'll go ahead and just return -EINVAL here! [...snip...] > > +static ssize_t weighted_interleave_auto_store(struct kobject *kobj, > > + struct kobj_attribute *attr, const char *buf, size_t count) > > +{ > > + struct weighted_interleave_state *new_wi_state, *old_wi_state = NULL; > > + unsigned int *bw; > > + bool input; > > + int i; > > + > > + if (kstrtobool(buf, &input)) > > + return -EINVAL; > > + > > + new_wi_state = kzalloc(struct_size(new_wi_state, iw_table, nr_node_ids), > > + GFP_KERNEL); > > + if (!new_wi_state) > > + return -ENOMEM; > > + for (i = 0; i < nr_node_ids; i++) > > + new_wi_state->iw_table[i] = 1; > > + > > + mutex_lock(&wi_state_lock); > > + if (!input) { > > If input == old_wi_state->mode_auto, we can return directly? Yes, that makes sense to me. > > static void wi_cleanup(void) { > > + sysfs_remove_file(&wi_group->wi_kobj, &wi_group->auto_kobj_attr.attr); > > Why not just > > sysfs_remove_file(&wi_group->wi_kobj, &wi_auto_attr.attr); > > ? Also makes sense!! > --- > Best Regards, > Huang, Ying Thank you for your great feedback Ying, I'll make changes based on your suggestions and shortly send up a v9. I hope you have a great day! Joshua