From owner-svn-src-stable-12@freebsd.org Mon Apr 6 18:52:41 2020 Return-Path: Delivered-To: svn-src-stable-12@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 16EF32782E8; Mon, 6 Apr 2020 18:52:41 +0000 (UTC) (envelope-from kib@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) server-signature RSA-PSS (4096 bits) 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 48x0606tVfz4T5n; Mon, 6 Apr 2020 18:52:40 +0000 (UTC) (envelope-from kib@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 E77EA2CAF0; Mon, 6 Apr 2020 18:52:40 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 036Iqe3S050567; Mon, 6 Apr 2020 18:52:40 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 036IqeBv050566; Mon, 6 Apr 2020 18:52:40 GMT (envelope-from kib@FreeBSD.org) Message-Id: <202004061852.036IqeBv050566@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Mon, 6 Apr 2020 18:52:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r359666 - stable/12/sys/kern X-SVN-Group: stable-12 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/12/sys/kern X-SVN-Commit-Revision: 359666 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Apr 2020 18:52:41 -0000 Author: kib Date: Mon Apr 6 18:52:40 2020 New Revision: 359666 URL: https://svnweb.freebsd.org/changeset/base/359666 Log: MFC r359468: kern_sendfile.c: add specific malloc type. Modified: stable/12/sys/kern/kern_sendfile.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/kern/kern_sendfile.c ============================================================================== --- stable/12/sys/kern/kern_sendfile.c Mon Apr 6 18:48:55 2020 (r359665) +++ stable/12/sys/kern/kern_sendfile.c Mon Apr 6 18:52:40 2020 (r359666) @@ -60,6 +60,8 @@ __FBSDID("$FreeBSD$"); #include #include +static MALLOC_DEFINE(M_SENDFILE, "sendfile", "sendfile dynamic memory"); + #define EXT_FLAG_SYNC EXT_FLAG_VENDOR1 #define EXT_FLAG_NOCACHE EXT_FLAG_VENDOR2 @@ -255,7 +257,7 @@ sendfile_iodone(void *arg, vm_page_t *pg, int count, i SOCK_LOCK(so); sorele(so); CURVNET_RESTORE(); - free(sfio, M_TEMP); + free(sfio, M_SENDFILE); } /* @@ -530,7 +532,7 @@ vn_sendfile(struct file *fp, int sockfd, struct uio *h SFSTAT_ADD(sf_rhpages_requested, SF_READAHEAD(flags)); if (flags & SF_SYNC) { - sfs = malloc(sizeof *sfs, M_TEMP, M_WAITOK | M_ZERO); + sfs = malloc(sizeof(*sfs), M_SENDFILE, M_WAITOK | M_ZERO); mtx_init(&sfs->mtx, "sendfile", NULL, MTX_DEF); cv_init(&sfs->cv, "sendfile"); } @@ -695,7 +697,7 @@ retry_space: npages, rhpages); sfio = malloc(sizeof(struct sf_io) + - npages * sizeof(vm_page_t), M_TEMP, M_WAITOK); + npages * sizeof(vm_page_t), M_SENDFILE, M_WAITOK); refcount_init(&sfio->nios, 1); sfio->so = so; sfio->error = 0; @@ -705,7 +707,7 @@ retry_space: if (error != 0) { if (vp != NULL) VOP_UNLOCK(vp, 0); - free(sfio, M_TEMP); + free(sfio, M_SENDFILE); goto done; } @@ -817,7 +819,7 @@ prepend_header: if (m == NULL) { KASSERT(softerr, ("%s: m NULL, no error", __func__)); error = softerr; - free(sfio, M_TEMP); + free(sfio, M_SENDFILE); goto done; } @@ -834,7 +836,7 @@ prepend_header: * we can send data right now without the * PRUS_NOTREADY flag. */ - free(sfio, M_TEMP); + free(sfio, M_SENDFILE); error = (*so->so_proto->pr_usrreqs->pru_send) (so, 0, m, NULL, NULL, td); } else { @@ -898,7 +900,7 @@ out: KASSERT(sfs->count == 0, ("sendfile sync still busy")); cv_destroy(&sfs->cv); mtx_destroy(&sfs->mtx); - free(sfs, M_TEMP); + free(sfs, M_SENDFILE); } if (error == ERESTART)