Author: markj Date: Sun Aug 25 21:14:46 2019 New Revision: 351496 URL: https://svnweb.freebsd.org/changeset/base/351496
Log: Handle UMA_ANYDOMAIN in kstack_import(). The kernel thread stack zone performs first-touch allocations by default, and must handle the case where the local memory domain is empty. For most UMA zones this is handled in the keg layer, but cache zones currently must implement a policy for this case. Simply use a round-robin policy if UMA_ANYDOMAIN is passed. Reported and tested by: bcran Reviewed by: kib Sponsored by: The FreeBSD Foundation Modified: head/sys/vm/uma.h head/sys/vm/uma_core.c head/sys/vm/vm_glue.c Modified: head/sys/vm/uma.h ============================================================================== --- head/sys/vm/uma.h Sun Aug 25 21:01:40 2019 (r351495) +++ head/sys/vm/uma.h Sun Aug 25 21:14:46 2019 (r351496) @@ -294,6 +294,8 @@ uma_zone_t uma_zcache_create(char *name, int size, uma #define UMA_ALIGN_CACHE (0 - 1) /* Cache line size align */ #define UMA_ALIGNOF(type) (_Alignof(type) - 1) /* Alignment fit for 'type' */ +#define UMA_ANYDOMAIN -1 /* Special value for domain search. */ + /* * Destroys an empty uma zone. If the zone is not empty uma complains loudly. * Modified: head/sys/vm/uma_core.c ============================================================================== --- head/sys/vm/uma_core.c Sun Aug 25 21:01:40 2019 (r351495) +++ head/sys/vm/uma_core.c Sun Aug 25 21:14:46 2019 (r351496) @@ -234,8 +234,6 @@ enum zfreeskip { SKIP_FINI = 0x00020000, }; -#define UMA_ANYDOMAIN -1 /* Special value for domain search. */ - /* Prototypes.. */ int uma_startup_count(int); Modified: head/sys/vm/vm_glue.c ============================================================================== --- head/sys/vm/vm_glue.c Sun Aug 25 21:01:40 2019 (r351495) +++ head/sys/vm/vm_glue.c Sun Aug 25 21:14:46 2019 (r351496) @@ -454,12 +454,18 @@ vm_thread_dispose(struct thread *td) static int kstack_import(void *arg, void **store, int cnt, int domain, int flags) { + struct domainset *ds; vm_object_t ksobj; int i; + if (domain == UMA_ANYDOMAIN) + ds = DOMAINSET_RR(); + else + ds = DOMAINSET_PREF(domain); + for (i = 0; i < cnt; i++) { - store[i] = (void *)vm_thread_stack_create( - DOMAINSET_PREF(domain), &ksobj, kstack_pages); + store[i] = (void *)vm_thread_stack_create(ds, &ksobj, + kstack_pages); if (store[i] == NULL) break; } _______________________________________________ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"