/* * Quicklist support. * * Quicklists are light weight lists of pages that have a defined state * on alloc and free. Pages must be in the quicklist specific defined state * (zero by default) when the page is freed. It seems that the initial idea * for such lists first came from Dave Miller and then various other people * improved on it. * * Copyright (C) 2007 SGI, * Christoph Lameter * Generalized, added support for multiple lists and * constructors / destructors. */ #include #include #include #include #include #include DEFINE_PER_CPU(struct quicklist [CONFIG_NR_QUICK], quicklist); #define FRACTION_OF_NODE_MEM 16 static unsigned long max_pages(unsigned long min_pages) { unsigned long node_free_pages, max; int node = numa_node_id(); struct zone *zones = NODE_DATA(node)->node_zones; int num_cpus_on_node; node_free_pages = #ifdef CONFIG_ZONE_DMA zone_page_state(&zones[ZONE_DMA], NR_FREE_PAGES) + #endif #ifdef CONFIG_ZONE_DMA32 zone_page_state(&zones[ZONE_DMA32], NR_FREE_PAGES) + #endif zone_page_state(&zones[ZONE_NORMAL], NR_FREE_PAGES); max = node_free_pages / FRACTION_OF_NODE_MEM; num_cpus_on_node = cpumask_weight(cpumask_of_node(node)); max /= num_cpus_on_node; return max(max, min_pages); } static long min_pages_to_free(struct quicklist *q, unsigned long min_pages, long max_free) { long pages_to_free; pages_to_free = q->nr_pages - max_pages(min_pages); return min(pages_to_free, max_free); } /* * Trim down the number of pages in the quicklist */ void quicklist_trim(int nr, void (*dtor)(void *), unsigned long min_pages, unsigned long max_free) { long pages_to_free; struct quicklist *q; q = &get_cpu_var(quicklist)[nr]; if (q->nr_pages > min_pages) { pages_to_free = min_pages_to_free(q, min_pages, max_free); while (pages_to_free > 0) { /* * We pass a gfp_t of 0 to quicklist_alloc here * because we will never call into the page allocator. */ void *p = quicklist_alloc(nr, 0, NULL); if (dtor) dtor(p); free_page((unsigned long)p); pages_to_free--; } } put_cpu_var(quicklist); } unsigned long quicklist_total_size(void) { unsigned long count = 0; int cpu; struct quicklist *ql, *q; for_each_online_cpu(cpu) { ql = per_cpu(quicklist, cpu); for (q = ql; q < ql + CONFIG_NR_QUICK; q++) count += q->nr_pages; } return count; } ue='fe07b62c8c4fcaadb039fab0de3541b4574ec3dc'/>
path: root/hw/xenpv
AgeCommit message (Expand)AuthorFilesLines
2019-01-14xen: Replace few mentions of xend by libxlAnthony PERARD1-1/+1
2019-01-14Remove broken Xen PV domain builderAnthony PERARD4-328/+0
2019-01-14xen: introduce new 'XenBus' and 'XenDevice' object hierarchyPaul Durrant1-0/+3
2019-01-14xen: re-name XenDevice to XenLegacyDevice...Paul Durrant2-2/+2
2019-01-11avoid TABs in files that only contain a fewPaolo Bonzini1-4/+4
2018-07-02hw/xen: Use the IEC binary prefix definitionsPhilippe Mathieu-Daudé1-6/+7
2018-02-06hw/xen*: Replace fprintf(stderr, "*\n" with error_report()Alistair Francis1-4/+5
2018-01-22Replace all occurances of __FUNCTION__ with __func__Alistair Francis2-9/+9
2017-07-07xenfb: remove xen_init_display "temporary" hackStefano Stabellini1-3/+0
2017-05-23shutdown: Add source information to SHUTDOWN and RESETEric Blake1-1/+1
2016-09-29xenpv: Fix qemu_uuid compiling errorFam Zheng1-1/+1
2016-09-23vl: Switch qemu_uuid to QemuUUIDFam Zheng1-5/+1
2016-08-03xen: use a common function for pv and hvm guest backend register callsJuergen Gross1-6/+1
2016-07-12Clean up decorations and whitespace around header guardsMarkus Armbruster1-1/+1
2016-06-22xen: move xen_sysdev to xen_backend.cJuergen Gross1-40/+0
2016-05-23xen: add pvUSB backendJuergen Gross1-0/+3
2016-05-23xen: introduce dummy system deviceJuergen Gross1-0/+40
2016-01-29xen: Clean up includesPeter Maydell2-1/+2
2016-01-26xen: make it possible to build without the Xen PV domain builderIan Campbell2-5/+14
2016-01-26xen: domainbuild: reopen libxenctrl interface after forking for domain watcher.Ian Campbell1-3/+6
2015-11-13xen: fix usage of xc_domain_create in domain builderRoger Pau Monne1-1/+1
2015-09-19Use DEFINE_MACHINE() to register all machinesEduardo Habkost1-11/+6
2014-10-20hw: Convert from BlockDriverState to BlockBackend, mostlyMarkus Armbruster1-1/+1
2014-05-28machine: Conversion of QEMUMachineInitArgs to MachineStateMarcel Apfelbaum1-4/+4
2014-05-07xen: move Xen PV machine files to hw/xenpvWei Liu4-0/+423