/* Try to acquire the OOM killer lock for the zones in zonelist. Returns zero if a parallel OOM killing is already taking place that includes a zone in the zonelist. Otherwise, locks all zones in the zonelist and returns 1.  */
int try_set_zone_oom(struct zonelist *zonelist, gfp_t gfp_mask)
/* Try to acquire the OOM killer lock for the zones in zonelist. Returns zero if a parallel OOM killing is already taking place that includes a zone in the zonelist. Otherwise, locks all zones in the zonelist and returns 1.  */
int try_set_zone_oom(struct zonelist *zonelist, gfp_t gfp_mask)
{
	struct zoneref *z;
	struct zone *zone;
	int ret = 1;
	spin_lock(&zone_scan_lock);
	for_each_zone_zonelist(zone, z, zonelist, gfp_zone(gfp_mask)) {
		if (zone_is_oom_locked(zone)) {
			ret = 0;
			goto out;
		}
	}
	for_each_zone_zonelist(zone, z, zonelist, gfp_zone(gfp_mask)) {
		zone_set_flag(zone, ZONE_OOM_LOCKED);
	}
out:
	spin_unlock(&zone_scan_lock);
	return ret;
}