mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: David Hildenbrand <david@redhat.com>
To: Marc Herbert <marc.herbert@linux.intel.com>,
	Dave Jiang <dave.jiang@intel.com>,
	linux-cxl@vger.kernel.org, linux-acpi@vger.kernel.org,
	linux-kernel@vger.kernel.org
Cc: gregkh@linuxfoundation.org, rafael@kernel.org, dakr@kernel.org,
	dave@stgolabs.net, jonathan.cameron@huawei.com,
	alison.schofield@intel.com, vishal.l.verma@intel.com,
	ira.weiny@intel.com, dan.j.williams@intel.com,
	akpm@linux-foundation.org
Subject: Re: [PATCH 1/4] mm/memory_hotplug: Update comment for hotplug memory callback priorities
Date: Tue, 19 Aug 2025 11:18:29 +0200	[thread overview]
Message-ID: <83a930e5-660e-49ed-8c34-66c4edf93665@redhat.com> (raw)
In-Reply-To: <3e48429a-b52d-43a1-b48a-06fb46f0a37c@linux.intel.com>

On 19.08.25 05:14, Marc Herbert wrote:
> 
> 
> On 2025-08-18 07:08, Dave Jiang wrote:
>>
>>
>> On 8/16/25 12:29 AM, David Hildenbrand wrote:
>>> On 14.08.25 19:16, Dave Jiang wrote:
>>>> Add clarification to comment for memory hotplug callback ordering as the
>>>> current comment does not provide clear language on which callback happens
>>>> first.
>>>>
>>>> Signed-off-by: Dave Jiang <dave.jiang@intel.com>
>>>> ---
>>>>    include/linux/memory.h | 2 +-
>>>>    1 file changed, 1 insertion(+), 1 deletion(-)
>>>>
>>>> diff --git a/include/linux/memory.h b/include/linux/memory.h
>>>> index 40eb70ccb09d..02314723e5bd 100644
>>>> --- a/include/linux/memory.h
>>>> +++ b/include/linux/memory.h
>>>> @@ -116,7 +116,7 @@ struct mem_section;
>>>>      /*
>>>>     * Priorities for the hotplug memory callback routines (stored in decreasing
>>>> - * order in the callback chain)
>>>> + * order in the callback chain). The callback ordering happens from high to low.
>>>>     */
>>>>    #define DEFAULT_CALLBACK_PRI    0
>>>>    #define SLAB_CALLBACK_PRI    1
>>>
>>> "stored in decreasing order in the callback chain"
>>>
>>> is pretty clear? It's a chain after all that gets called.
>>
>> I can drop the patch. For some reason when I read it I'm thinking the opposite, and when Marc was also confused I started questioning things.
>>
> 
> I think we both found the current comment confusing (even together!)
> because:
> 
> - It very briefly alludes to an implementation detail (the chain)
>    without really getting into detail. A "chain" could be bi-directional;
>    why not? This one is... "most likely" not. Doubt.
> 

Please note that the memory notifier is really just using the generic 
*notifier chain* mechanism as documented in include/linux/notifier.h.

Here is a good summary of that mechanism. I don't quite agree with the 
"implementation detail" part, but that information might indeed not be 
required here.

https://0xax.gitbooks.io/linux-insides/content/Concepts/linux-cpu-4.html

> - Higher priorities can have lower numbers, example: "P1 bugs". Not the
>    case here, but this "double standards" situation makes _all_
>    priorities suspicious and confusing.
> 

Yes, "priorities" are handled differently in different context.

> - Constants that come first in the file are called last.

Yes, but that part makes perfect sense to me.
  > I would go further than Dave and also drop the "chain" implementation
> detail because it makes the reader to think too much.  Not needed and
> distracting at this particular point in the file.

  > /*
>   * Priorities for the hotplug memory callback routines.
>   * Invoked from high to low.
>   */
> 
>    => Hopefully zero cognitive load.

Still confusion about how a high priority translates to a number, maybe?

/*
  * Priorities for the hotplug memory callback routines. Invoked from
  * high to low. Higher priorities corresponds to higher numbers.
  */

-- 
Cheers

David / dhildenb


  reply	other threads:[~2025-08-19  9:18 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-14 17:16 [PATCH 0/4] cxl, acpi/hmat, node: Update CXL access coordinates to node directly Dave Jiang
2025-08-14 17:16 ` [PATCH 1/4] mm/memory_hotplug: Update comment for hotplug memory callback priorities Dave Jiang
2025-08-16  7:29   ` David Hildenbrand
2025-08-18 14:08     ` Dave Jiang
2025-08-19  3:14       ` Marc Herbert
2025-08-19  9:18         ` David Hildenbrand [this message]
2025-08-19 15:39           ` Dave Jiang
2025-08-19 19:08             ` David Hildenbrand
2025-08-14 17:16 ` [PATCH 2/4] drivers/base/node: Add a helper function node_update_perf_attrs() Dave Jiang
2025-08-15 13:28   ` Jonathan Cameron
2025-08-18  9:49   ` David Hildenbrand
2025-08-19 17:00     ` Dave Jiang
2025-08-14 17:16 ` [PATCH 3/4] cxl, acpi/hmat: Update CXL access coordinates directly instead of through HMAT Dave Jiang
2025-08-14 22:33   ` dan.j.williams
2025-08-14 22:59     ` Dave Jiang
2025-08-14 23:09     ` Marc Herbert
2025-08-15 13:31   ` Jonathan Cameron
2025-08-15 15:35     ` Dave Jiang
2025-08-15 15:56       ` Jonathan Cameron
2025-08-14 17:16 ` [PATCH 4/4] acpi/hmat: Remove now unused hmat_update_target_coordinates() Dave Jiang
2025-08-15 13:31   ` Jonathan Cameron

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83a930e5-660e-49ed-8c34-66c4edf93665@redhat.com \
    --to=david@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=alison.schofield@intel.com \
    --cc=dakr@kernel.org \
    --cc=dan.j.williams@intel.com \
    --cc=dave.jiang@intel.com \
    --cc=dave@stgolabs.net \
    --cc=gregkh@linuxfoundation.org \
    --cc=ira.weiny@intel.com \
    --cc=jonathan.cameron@huawei.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-cxl@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marc.herbert@linux.intel.com \
    --cc=rafael@kernel.org \
    --cc=vishal.l.verma@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®