switch (shift) { case 0: return ctor_0; case 1: return ctor_1; case 2: return ctor_2; case 3: return ctor_3; case 4: return ctor_4; case 5: return ctor_5; case 6: return ctor_6; case 7: return ctor_7; case 8: return ctor_8; case 9: return ctor_9; case 10: return ctor_10; case 11: return ctor_11; case 12: return ctor_12; case 13: return ctor_13; case 14: return ctor_14; case 15: return ctor_15;
} return NULL;
}
struct kmem_cache *pgtable_cache[MAX_PGTABLE_INDEX_SIZE + 1];
EXPORT_SYMBOL_GPL(pgtable_cache); /* used by kvm_hv module */
/* * Create a kmem_cache() for pagetables. This is not used for PTE * pages - they're linked to struct page, come from the normal free * pages pool and have a different entry size (see real_pte_t) to * everything else. Caches created by this function are used for all * the higher level pagetables, and for hugepage pagetables.
*/ void pgtable_cache_add(unsignedint shift)
{ char *name; unsignedlong table_size = sizeof(pgd_t) << shift; unsignedlong align = table_size;
/* When batching pgtable pointers for RCU freeing, we store * the index size in the low bits. Table alignment must be * big enough to fit it.
*/ unsignedlong minalign = MAX_PGTABLE_INDEX_SIZE + 1; struct kmem_cache *new = NULL;
/* It would be nice if this was a BUILD_BUG_ON(), but at the * moment, gcc doesn't seem to recognize is_power_of_2 as a
* constant expression, so so much for that. */
BUG_ON(!is_power_of_2(minalign));
BUG_ON(shift > MAX_PGTABLE_INDEX_SIZE);
if (PGT_CACHE(shift)) return; /* Already have a cache of this size */
align = max_t(unsignedlong, align, minalign);
name = kasprintf(GFP_KERNEL, "pgtable-2^%d", shift); if (name) new = kmem_cache_create(name, table_size, align, 0, ctor(shift)); if (!new)
panic("Could not allocate pgtable cache for order %d", shift);
kfree(name);
pgtable_cache[shift] = new;
pr_debug("Allocated pgtable cache for order %d\n", shift);
}
EXPORT_SYMBOL_GPL(pgtable_cache_add); /* used by kvm_hv module */
if (PMD_CACHE_INDEX)
pgtable_cache_add(PMD_CACHE_INDEX); /* * In all current configs, when the PUD index exists it's the * same size as either the pgd or pmd index except with THP enabled * on book3s 64
*/ if (PUD_CACHE_INDEX)
pgtable_cache_add(PUD_CACHE_INDEX);
}
Messung V0.5
¤ Dauer der Verarbeitung: 0.9 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.