Re: [PATCH 1/3] mm/mempolicy: Use the already fetched local variable

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 2/19/24 03:08, Andrew Morton wrote:
On Sat, 17 Feb 2024 01:31:33 -0600 Donet Tom <donettom@xxxxxxxxxxxxx> wrote:

Avoid doing a per cpu read and use the local variable thisnid. IMHO
this also makes the code more readable.

...

--- a/mm/mempolicy.c
+++ b/mm/mempolicy.c
@@ -2526,7 +2526,7 @@ int mpol_misplaced(struct folio *folio, struct vm_area_struct *vma,
  		if (node_isset(curnid, pol->nodes))
  			goto out;
  		z = first_zones_zonelist(
-				node_zonelist(numa_node_id(), GFP_HIGHUSER),
+				node_zonelist(thisnid, GFP_HIGHUSER),
  				gfp_zone(GFP_HIGHUSER),
  				&pol->nodes);
  		polnid = zone_to_nid(z->zone);
	int thisnid = cpu_to_node(thiscpu);

Is there any dofference between numa_node_id() and
cpu_to_node(raw_smp_processor_id())?  And it it explicable that we're
using one here and not the other?

Hi Andrew

Both numa_node_id() and cpu_to_node(raw_smp_processor_id()) return the current execution node id,
Since the current execution node is already fetched at the beginning (thisnid) we can reuse it instead of getting it again.

Thanks
Donet Tom






[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux