From owner-svn-src-head@freebsd.org Thu Nov 12 20:22:59 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AE022464055; Thu, 12 Nov 2020 20:22:59 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CXChg4Xknz4jvM; Thu, 12 Nov 2020 20:22:59 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8EF3E490B; Thu, 12 Nov 2020 20:22:59 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0ACKMxrY096168; Thu, 12 Nov 2020 20:22:59 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0ACKMxXx096165; Thu, 12 Nov 2020 20:22:59 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <202011122022.0ACKMxXx096165@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Thu, 12 Nov 2020 20:22:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367627 - in head/sys: kern sys X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: in head/sys: kern sys X-SVN-Commit-Revision: 367627 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Nov 2020 20:22:59 -0000 Author: mjg Date: Thu Nov 12 20:22:58 2020 New Revision: 367627 URL: https://svnweb.freebsd.org/changeset/base/367627 Log: malloc: retire malloc_last_fail The routine does not serve any practical purpose. Memory can be allocated in many other ways and most consumers pass the M_WAITOK flag, making malloc not fail in the first place. Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D27143 Modified: head/sys/kern/kern_malloc.c head/sys/sys/malloc.h head/sys/sys/param.h Modified: head/sys/kern/kern_malloc.c ============================================================================== --- head/sys/kern/kern_malloc.c Thu Nov 12 20:20:57 2020 (r367626) +++ head/sys/kern/kern_malloc.c Thu Nov 12 20:22:58 2020 (r367627) @@ -231,11 +231,6 @@ static int sysctl_kern_mprof(SYSCTL_HANDLER_ARGS); static int sysctl_kern_malloc_stats(SYSCTL_HANDLER_ARGS); -/* - * time_uptime of the last malloc(9) failure (induced or real). - */ -static time_t t_malloc_fail; - #if defined(MALLOC_MAKE_FAILURES) || (MALLOC_DEBUG_MAXZONES > 1) static SYSCTL_NODE(_debug, OID_AUTO, malloc, CTLFLAG_RD | CTLFLAG_MPSAFE, 0, "Kernel malloc debugging options"); @@ -373,13 +368,6 @@ mtp_get_subzone(struct malloc_type *mtp) } #endif /* MALLOC_DEBUG_MAXZONES > 1 */ -int -malloc_last_fail(void) -{ - - return (time_uptime - t_malloc_fail); -} - /* * An allocation has succeeded -- update malloc type statistics for the * amount of bucket size. Occurs within a critical section so that the @@ -535,7 +523,6 @@ malloc_dbg(caddr_t *vap, size_t *sizep, struct malloc_ atomic_add_int(&malloc_nowait_count, 1); if ((malloc_nowait_count % malloc_failure_rate) == 0) { atomic_add_int(&malloc_failure_count, 1); - t_malloc_fail = time_uptime; *vap = NULL; return (EJUSTRETURN); } @@ -662,7 +649,6 @@ void * if (__predict_false(va == NULL)) { KASSERT((flags & M_WAITOK) == 0, ("malloc(M_WAITOK) returned NULL")); - t_malloc_fail = time_uptime; } #ifdef DEBUG_REDZONE if (va != NULL) @@ -730,7 +716,6 @@ malloc_domainset(size_t size, struct malloc_type *mtp, if (__predict_false(va == NULL)) { KASSERT((flags & M_WAITOK) == 0, ("malloc(M_WAITOK) returned NULL")); - t_malloc_fail = time_uptime; } #ifdef DEBUG_REDZONE if (va != NULL) @@ -761,7 +746,6 @@ malloc_exec(size_t size, struct malloc_type *mtp, int if (__predict_false(va == NULL)) { KASSERT((flags & M_WAITOK) == 0, ("malloc(M_WAITOK) returned NULL")); - t_malloc_fail = time_uptime; } #ifdef DEBUG_REDZONE if (va != NULL) @@ -791,7 +775,6 @@ malloc_domainset_exec(size_t size, struct malloc_type if (__predict_false(va == NULL)) { KASSERT((flags & M_WAITOK) == 0, ("malloc(M_WAITOK) returned NULL")); - t_malloc_fail = time_uptime; } #ifdef DEBUG_REDZONE if (va != NULL) Modified: head/sys/sys/malloc.h ============================================================================== --- head/sys/sys/malloc.h Thu Nov 12 20:20:57 2020 (r367626) +++ head/sys/sys/malloc.h Thu Nov 12 20:22:58 2020 (r367627) @@ -252,7 +252,6 @@ void *malloc_domainset_exec(size_t size, struct malloc struct domainset *ds, int flags) __malloc_like __result_use_check __alloc_size(1); void malloc_init(void *); -int malloc_last_fail(void); void malloc_type_allocated(struct malloc_type *type, unsigned long size); void malloc_type_freed(struct malloc_type *type, unsigned long size); void malloc_type_list(malloc_type_list_func_t *, void *); Modified: head/sys/sys/param.h ============================================================================== --- head/sys/sys/param.h Thu Nov 12 20:20:57 2020 (r367626) +++ head/sys/sys/param.h Thu Nov 12 20:22:58 2020 (r367627) @@ -60,7 +60,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1300128 /* Master, propagated to newvers */ +#define __FreeBSD_version 1300129 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD,