Skip to contentSkip to conversation

mm: page_alloc: calculate classzone_idx once from the zonelist ref

PATCH In review Dan Carpenter 3 participants 3 messages May 20, 2014 – May 21, 2014

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hello Mel Gorman,

The patch a486e00b8283: "mm: page_alloc: calculate classzone_idx once from the zonelist ref" from May 17, 2014, leads to the following static checker warning:

	mm/page_alloc.c:2543 __alloc_pages_slowpath()
	warn: we tested 'nodemask' before and it was 'false'

mm/page_alloc.c

  2537           * Find the true preferred zone if the allocation is unconstrained by
  2538           * cpusets.
  2539           */
  2540          if (!(alloc_flags & ALLOC_CPUSET) && !nodemask) {
                                                     ^^^^^^^^^

Patch introduces this test.

2541 struct zoneref *preferred_zoneref;
2542 preferred_zoneref = first_zones_zonelist(zonelist, high_zoneidx,
2543 nodemask ? : &cpuset_current_mems_allowed,

                                        ^^^^^^^^

Patch introduces this test as well.

  2544                                  &preferred_zone);
  2545                  classzone_idx = zonelist_zone_idx(preferred_zoneref);
  2546          }

regards,
dan carpenter

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#1 lore raw

PATCH 1/1 mm: page_alloc: Calculate classzone_idx once from the zonelist ref

Dan Carpenter reported the following bug

The patch a486e00b8283: "mm: page_alloc: calculate classzone_idx once from the zonelist ref" from May 17, 2014, leads to the following static checker warning:

mm/page_alloc.c:2543 __alloc_pages_slowpath()
warn: we tested 'nodemask' before and it was 'false'

mm/page_alloc.c

  2537           * Find the true preferred zone if the allocation is unconstrained by
  2538           * cpusets.
  2539           */
  2540          if (!(alloc_flags & ALLOC_CPUSET) && !nodemask) {
                                                     ^^^^^^^^^

Patch introduces this test.

2541 struct zoneref *preferred_zoneref;
2542 preferred_zoneref = first_zones_zonelist(zonelist, high_zoneidx,
2543 nodemask ? : &cpuset_current_mems_allowed,

                                        ^^^^^^^^

Patch introduces this test as well.

  2544                                  &preferred_zone);
  2545                  classzone_idx = zonelist_zone_idx(preferred_zoneref);
  2546          }

This patch should resolve it and is a fix to the mmotm patch mm-page_alloc-calculate-classzone_idx-once-from-the-zonelist-ref

---
 mm/page_alloc.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
mm/page_alloc.c +1 -2
index 0959b09..ebb947d 100644
@@ -2590,8 +2590,7 @@ restart:
 	if (!(alloc_flags & ALLOC_CPUSET) && !nodemask) {
 		struct zoneref *preferred_zoneref;
 		preferred_zoneref = first_zones_zonelist(zonelist, high_zoneidx,
-				nodemask ? : &cpuset_current_mems_allowed,
-				&preferred_zone);
+				NULL, &preferred_zone);
 		classzone_idx = zonelist_zone_idx(preferred_zoneref);
 	}
 

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

Acked-by on v1 1/1
#2 lore raw

Re: [PATCH] mm: page_alloc: Calculate classzone_idx once from the zonelist ref

Quoted 40 lines · Mel Gorman

Dan Carpenter reported the following bug

The patch a486e00b8283: "mm: page_alloc: calculate classzone_idx once from the zonelist ref" from May 17, 2014, leads to the following static checker warning:

mm/page_alloc.c:2543 __alloc_pages_slowpath()
warn: we tested 'nodemask' before and it was 'false'

mm/page_alloc.c

  2537           * Find the true preferred zone if the allocation is unconstrained by
  2538           * cpusets.
  2539           */
  2540          if (!(alloc_flags & ALLOC_CPUSET) && !nodemask) {
                                                     ^^^^^^^^^

Patch introduces this test.

2541 struct zoneref *preferred_zoneref;
2542 preferred_zoneref = first_zones_zonelist(zonelist, high_zoneidx,
2543 nodemask ? : &cpuset_current_mems_allowed,

                                        ^^^^^^^^

Patch introduces this test as well.

  2544                                  &preferred_zone);
  2545                  classzone_idx = zonelist_zone_idx(preferred_zoneref);
  2546          }

This patch should resolve it and is a fix to the mmotm patch mm-page_alloc-calculate-classzone_idx-once-from-the-zonelist-ref

---
 mm/page_alloc.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
mm/page_alloc.c +0 -0
index 0959b09..ebb947d 100644

mm/page_alloc.c restart: · line 2596

Quoted 9 lines
mm/page_alloc.c +1 -2
@@ -2590,8 +2590,7 @@ restart:
 	if (!(alloc_flags & ALLOC_CPUSET) && !nodemask) {
 		struct zoneref *preferred_zoneref;
 		preferred_zoneref = first_zones_zonelist(zonelist, high_zoneidx,
-				nodemask ? : &cpuset_current_mems_allowed,
-				&preferred_zone);
+				NULL, &preferred_zone);
 		classzone_idx = zonelist_zone_idx(preferred_zoneref);
 	}
 

The switch from "nodemask : &cpuset_current_mems_allowed" to NULL isn't described in the changelog but makes sense as well because of !(alloc_flags & ALLOC_CPUSET).

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>