/** * swap_cgroup_record - record mem_cgroup for a set of swap entries. * These entries must belong to one single folio, and that folio * must be being charged for swap space (swap out), and these * entries must not have been charged * * @folio: the folio that the swap entry belongs to * @id: mem_cgroup ID to be recorded * @ent: the first swap entry to be recorded
*/ void swap_cgroup_record(struct folio *folio, unsignedshort id,
swp_entry_t ent)
{ unsignedint nr_ents = folio_nr_pages(folio); struct swap_cgroup *map;
pgoff_t offset, end; unsignedshort old;
do {
old = __swap_cgroup_id_xchg(map, offset, id);
VM_BUG_ON(old);
} while (++offset != end);
}
/** * swap_cgroup_clear - clear mem_cgroup for a set of swap entries. * These entries must be being uncharged from swap. They either * belongs to one single folio in the swap cache (swap in for * cgroup v1), or no longer have any users (slot freeing). * * @ent: the first swap entry to be recorded into * @nr_ents: number of swap entries to be recorded * * Returns the existing old value.
*/ unsignedshort swap_cgroup_clear(swp_entry_t ent, unsignedint nr_ents)
{
pgoff_t offset, end; struct swap_cgroup *map; unsignedshort old, iter = 0;
do {
old = __swap_cgroup_id_xchg(map, offset, 0); if (!iter)
iter = old;
VM_BUG_ON(iter != old);
} while (++offset != end);
return old;
}
/** * lookup_swap_cgroup_id - lookup mem_cgroup id tied to swap entry * @ent: swap entry to be looked up. * * Returns ID of mem_cgroup at success. 0 at failure. (0 is invalid ID)
*/ unsignedshort lookup_swap_cgroup_id(swp_entry_t ent)
{ struct swap_cgroup_ctrl *ctrl;
return 0;
nomem:
pr_info("couldn't allocate enough memory for swap_cgroup\n");
pr_info("swap_cgroup can be disabled by swapaccount=0 boot option\n"); return -ENOMEM;
}
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.