コード例 #1
0
void tune_lmk_zone_param(struct zonelist *zonelist, int classzone_idx,
                         int *other_free, int *other_file)
{
    struct zone *zone;
    struct zoneref *zoneref;
    int zone_idx;

    for_each_zone_zonelist(zone, zoneref, zonelist, MAX_NR_ZONES) {
        zone_idx = zonelist_zone_idx(zoneref);
        if (zone_idx == ZONE_MOVABLE) {
            continue;
        }

        if (zone_idx > classzone_idx) {
            if (other_free != NULL)
                *other_free -= zone_page_state(zone,
                                               NR_FREE_PAGES);
            if (other_file != NULL)
                *other_file -= zone_page_state(zone,
                                               NR_FILE_PAGES)
                               - zone_page_state(zone, NR_SHMEM);
        } else if (zone_idx < classzone_idx) {
            if (zone_watermark_ok(zone, 0, 0, classzone_idx, 0)) {
                *other_free -=
                    zone->lowmem_reserve[classzone_idx];
            } else {
                *other_free -=
                    zone_page_state(zone, NR_FREE_PAGES);
            }
        }
    }
コード例 #2
0
ファイル: mmzone.c プロジェクト: Albinoman887/pyramid-3.4.10
struct zoneref *next_zones_zonelist(struct zoneref *z,
					enum zone_type highest_zoneidx,
					nodemask_t *nodes,
					struct zone **zone)
{
	if (likely(nodes == NULL))
		while (zonelist_zone_idx(z) > highest_zoneidx)
			z++;
	else
		while (zonelist_zone_idx(z) > highest_zoneidx ||
				(z->zone && !zref_in_nodemask(z, nodes)))
			z++;

	*zone = zonelist_zone(z);
	return z;
}
コード例 #3
0
/* Returns the next zone at or below highest_zoneidx in a zonelist */
struct zoneref *next_zones_zonelist(struct zoneref *z,
					enum zone_type highest_zoneidx,
					nodemask_t *nodes)
{
	/*
	 * Find the next suitable zone to use for the allocation.
	 * Only filter based on nodemask if it's set
	 */
	if (likely(nodes == NULL))
		while (zonelist_zone_idx(z) > highest_zoneidx)
			z++;
	else
		while (zonelist_zone_idx(z) > highest_zoneidx ||
				(z->zone && !zref_in_nodemask(z, nodes)))
			z++;

	return z;
}
コード例 #4
0
ファイル: mmzone.c プロジェクト: arm10c/linux-stable
// ARM10C 20140308
// zonelist->_zonerefs: contig_page_data->node_zonelists->_zonerefs
// highest_zoneidx: 0, nodes: 0, &zone
// ARM10C 20140426
// zonelist->_zonerefs: contig_page_data->node_zonelists->_zonerefs
// highest_zoneidx: 0, nodes: &node_states[N_HIGH_MEMORY], zone: &preferred_zone
struct zoneref *next_zones_zonelist(struct zoneref *z,
					enum zone_type highest_zoneidx,
					nodemask_t *nodes,
					struct zone **zone)
{
	/*
	 * Find the next suitable zone to use for the allocation.
	 * Only filter based on nodemask if it's set
	 */
	// nodes: 0
	// ARM10C 20140426
	// nodes: &node_states[N_HIGH_MEMORY]
	if (likely(nodes == NULL))
		// z: contig_page_data->node_zonelists->_zonerefs[0], highest_zoneidx: 0
		// z: contig_page_data->node_zonelists->_zonerefs[1], highest_zoneidx: 0
		// [2nd] zonelist_zone_idx(z): 0
		while (zonelist_zone_idx(z) > highest_zoneidx)
			// [1st] zonelist_zone_idx(z): 1
			z++;
			// [1st] z: contig_page_data->node_zonelists->_zonerefs[1]
	else
		// ARM10C 20140426
		// z: contig_page_data->node_zonelists->_zonerefs, zonelist_zone_idx(z): 1
		// highest_zoneidx: 0
		while (zonelist_zone_idx(z) > highest_zoneidx ||
				(z->zone && !zref_in_nodemask(z, nodes)))
			z++;

	// z: contig_page_data->node_zonelists->_zonerefs[1]
	*zone = zonelist_zone(z);
	// zone: contig_page_data->node_zones[0]

	// z: contig_page_data->node_zonelists->_zonerefs[1]
	return z;
	// return contig_page_data->node_zonelists->_zonerefs[1]
}