From owner-svn-src-stable-10@freebsd.org Sat Jan 9 16:20:31 2016 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B6CB1A69AFA; Sat, 9 Jan 2016 16:20:31 +0000 (UTC) (envelope-from dchagin@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 mx1.freebsd.org (Postfix) with ESMTPS id 6F7C711BB; Sat, 9 Jan 2016 16:20:31 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u09GKUkn035191; Sat, 9 Jan 2016 16:20:30 GMT (envelope-from dchagin@FreeBSD.org) Received: (from dchagin@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u09GKTfj035180; Sat, 9 Jan 2016 16:20:29 GMT (envelope-from dchagin@FreeBSD.org) Message-Id: <201601091620.u09GKTfj035180@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dchagin set sender to dchagin@FreeBSD.org using -f From: Dmitry Chagin Date: Sat, 9 Jan 2016 16:20:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r293532 - stable/10/sys/compat/linux X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Jan 2016 16:20:31 -0000 Author: dchagin Date: Sat Jan 9 16:20:29 2016 New Revision: 293532 URL: https://svnweb.freebsd.org/changeset/base/293532 Log: MFC r283427: Where possible we will use M_LINUX malloc(9) type. Move M_FUTEX defines to the linux_common.ko. Modified: stable/10/sys/compat/linux/linux_emul.c stable/10/sys/compat/linux/linux_file.c stable/10/sys/compat/linux/linux_futex.c stable/10/sys/compat/linux/linux_getcwd.c stable/10/sys/compat/linux/linux_misc.c stable/10/sys/compat/linux/linux_socket.c stable/10/sys/compat/linux/linux_sysctl.c stable/10/sys/compat/linux/linux_uid16.c stable/10/sys/compat/linux/linux_util.c stable/10/sys/compat/linux/linux_util.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/compat/linux/linux_emul.c ============================================================================== --- stable/10/sys/compat/linux/linux_emul.c Sat Jan 9 16:16:16 2016 (r293531) +++ stable/10/sys/compat/linux/linux_emul.c Sat Jan 9 16:20:29 2016 (r293532) @@ -98,7 +98,7 @@ linux_proc_init(struct thread *td, struc em->em_tid = newtd->td_proc->p_pid; - pem = malloc(sizeof(*pem), M_TEMP, M_WAITOK | M_ZERO); + pem = malloc(sizeof(*pem), M_LINUX, M_WAITOK | M_ZERO); sx_init(&pem->pem_sx, "lpemlk"); newtd->td_proc->p_emuldata = pem; } @@ -134,7 +134,7 @@ linux_proc_exit(void *arg __unused, stru p->p_emuldata = NULL; sx_destroy(&pem->pem_sx); - free(pem, M_TEMP); + free(pem, M_LINUX); } int @@ -181,7 +181,7 @@ linux_common_execve(struct thread *td, s PROC_UNLOCK(p); free(em, M_TEMP); - free(pem, M_TEMP); + free(pem, M_LINUX); } return (0); } Modified: stable/10/sys/compat/linux/linux_file.c ============================================================================== --- stable/10/sys/compat/linux/linux_file.c Sat Jan 9 16:16:16 2016 (r293531) +++ stable/10/sys/compat/linux/linux_file.c Sat Jan 9 16:20:29 2016 (r293532) @@ -369,8 +369,8 @@ getdents_common(struct thread *td, struc buflen = max(LINUX_DIRBLKSIZ, nbytes); buflen = min(buflen, MAXBSIZE); - buf = malloc(buflen, M_TEMP, M_WAITOK); - lbuf = malloc(LINUX_MAXRECLEN, M_TEMP, M_WAITOK | M_ZERO); + buf = malloc(buflen, M_LINUX, M_WAITOK); + lbuf = malloc(LINUX_MAXRECLEN, M_LINUX, M_WAITOK | M_ZERO); vn_lock(vp, LK_SHARED | LK_RETRY); aiov.iov_base = buf; @@ -521,8 +521,8 @@ out: VOP_UNLOCK(vp, 0); foffset_unlock(fp, off, 0); fdrop(fp, td); - free(buf, M_TEMP); - free(lbuf, M_TEMP); + free(buf, M_LINUX); + free(lbuf, M_LINUX); return (error); } Modified: stable/10/sys/compat/linux/linux_futex.c ============================================================================== --- stable/10/sys/compat/linux/linux_futex.c Sat Jan 9 16:16:16 2016 (r293531) +++ stable/10/sys/compat/linux/linux_futex.c Sat Jan 9 16:20:29 2016 (r293532) @@ -185,9 +185,6 @@ LIN_SDT_PROBE_DEFINE2(futex, release_fut LIN_SDT_PROBE_DEFINE1(futex, release_futexes, copyin_error, "int"); LIN_SDT_PROBE_DEFINE0(futex, release_futexes, return); -static MALLOC_DEFINE(M_FUTEX, "futex", "Linux futexes"); -static MALLOC_DEFINE(M_FUTEX_WP, "futex wp", "Linux futexes wp"); - struct futex; struct waiting_proc { Modified: stable/10/sys/compat/linux/linux_getcwd.c ============================================================================== --- stable/10/sys/compat/linux/linux_getcwd.c Sat Jan 9 16:16:16 2016 (r293531) +++ stable/10/sys/compat/linux/linux_getcwd.c Sat Jan 9 16:20:29 2016 (r293532) @@ -186,7 +186,7 @@ linux_getcwd_scandir(lvpp, uvpp, bpp, bu dirbuflen = DIRBLKSIZ; if (dirbuflen < va.va_blocksize) dirbuflen = va.va_blocksize; - dirbuf = malloc(dirbuflen, M_TEMP, M_WAITOK); + dirbuf = malloc(dirbuflen, M_LINUX, M_WAITOK); #if 0 unionread: @@ -274,7 +274,7 @@ unionread: out: vput(lvp); *lvpp = NULL; - free(dirbuf, M_TEMP); + free(dirbuf, M_LINUX); return error; } Modified: stable/10/sys/compat/linux/linux_misc.c ============================================================================== --- stable/10/sys/compat/linux/linux_misc.c Sat Jan 9 16:16:16 2016 (r293531) +++ stable/10/sys/compat/linux/linux_misc.c Sat Jan 9 16:20:29 2016 (r293532) @@ -1204,7 +1204,7 @@ linux_setgroups(struct thread *td, struc ngrp = args->gidsetsize; if (ngrp < 0 || ngrp >= ngroups_max + 1) return (EINVAL); - linux_gidset = malloc(ngrp * sizeof(*linux_gidset), M_TEMP, M_WAITOK); + linux_gidset = malloc(ngrp * sizeof(*linux_gidset), M_LINUX, M_WAITOK); error = copyin(args->grouplist, linux_gidset, ngrp * sizeof(l_gid_t)); if (error) goto out; @@ -1243,7 +1243,7 @@ linux_setgroups(struct thread *td, struc crfree(oldcred); error = 0; out: - free(linux_gidset, M_TEMP); + free(linux_gidset, M_LINUX); return (error); } @@ -1275,14 +1275,14 @@ linux_getgroups(struct thread *td, struc ngrp = 0; linux_gidset = malloc(bsd_gidsetsz * sizeof(*linux_gidset), - M_TEMP, M_WAITOK); + M_LINUX, M_WAITOK); while (ngrp < bsd_gidsetsz) { linux_gidset[ngrp] = bsd_gidset[ngrp + 1]; ngrp++; } error = copyout(linux_gidset, args->grouplist, ngrp * sizeof(l_gid_t)); - free(linux_gidset, M_TEMP); + free(linux_gidset, M_LINUX); if (error) return (error); Modified: stable/10/sys/compat/linux/linux_socket.c ============================================================================== --- stable/10/sys/compat/linux/linux_socket.c Sat Jan 9 16:16:16 2016 (r293531) +++ stable/10/sys/compat/linux/linux_socket.c Sat Jan 9 16:20:29 2016 (r293532) @@ -609,7 +609,7 @@ linux_sendto_hdrincl(struct thread *td, linux_args->len > IP_MAXPACKET) return (EINVAL); - packet = (struct ip *)malloc(linux_args->len, M_TEMP, M_WAITOK); + packet = (struct ip *)malloc(linux_args->len, M_LINUX, M_WAITOK); /* Make kernel copy of the packet to be sent */ if ((error = copyin(PTRIN(linux_args->msg), packet, @@ -632,7 +632,7 @@ linux_sendto_hdrincl(struct thread *td, error = linux_sendit(td, linux_args->s, &msg, linux_args->flags, NULL, UIO_SYSSPACE); goout: - free(packet, M_TEMP); + free(packet, M_LINUX); return (error); } @@ -1119,7 +1119,7 @@ linux_sendmsg(struct thread *td, struct free(sa, M_SONAME); error = ENOBUFS; - cmsg = malloc(CMSG_HDRSZ, M_TEMP, M_WAITOK | M_ZERO); + cmsg = malloc(CMSG_HDRSZ, M_LINUX, M_WAITOK | M_ZERO); control = m_get(M_WAITOK, MT_CONTROL); if (control == NULL) goto bad; @@ -1197,7 +1197,7 @@ linux_sendmsg(struct thread *td, struct bad: free(iov, M_IOV); if (cmsg) - free(cmsg, M_TEMP); + free(cmsg, M_LINUX); return (error); } @@ -1270,7 +1270,7 @@ linux_recvmsg(struct thread *td, struct outlen = 0; if (control) { - linux_cmsg = malloc(L_CMSG_HDRSZ, M_TEMP, M_WAITOK | M_ZERO); + linux_cmsg = malloc(L_CMSG_HDRSZ, M_LINUX, M_WAITOK | M_ZERO); msg.msg_control = mtod(control, struct cmsghdr *); msg.msg_controllen = control->m_len; @@ -1363,7 +1363,7 @@ out: bad: free(iov, M_IOV); m_freem(control); - free(linux_cmsg, M_TEMP); + free(linux_cmsg, M_LINUX); return (error); } Modified: stable/10/sys/compat/linux/linux_sysctl.c ============================================================================== --- stable/10/sys/compat/linux/linux_sysctl.c Sat Jan 9 16:16:16 2016 (r293531) +++ stable/10/sys/compat/linux/linux_sysctl.c Sat Jan 9 16:20:29 2016 (r293532) @@ -141,12 +141,12 @@ linux_sysctl(struct thread *td, struct l return (ENOTDIR); } - mib = malloc(la.nlen * sizeof(l_int), M_TEMP, M_WAITOK); + mib = malloc(la.nlen * sizeof(l_int), M_LINUX, M_WAITOK); error = copyin(PTRIN(la.name), mib, la.nlen * sizeof(l_int)); if (error) { LIN_SDT_PROBE1(sysctl, linux_sysctl, copyin_error, error); LIN_SDT_PROBE1(sysctl, linux_sysctl, return, error); - free(mib, M_TEMP); + free(mib, M_LINUX); return (error); } @@ -158,7 +158,7 @@ linux_sysctl(struct thread *td, struct l switch (mib[1]) { case LINUX_KERN_VERSION: error = handle_string(&la, version); - free(mib, M_TEMP); + free(mib, M_LINUX); LIN_SDT_PROBE1(sysctl, linux_sysctl, return, error); return (error); default: @@ -187,7 +187,7 @@ linux_sysctl(struct thread *td, struct l sbuf_delete(sb); } - free(mib, M_TEMP); + free(mib, M_LINUX); LIN_SDT_PROBE1(sysctl, linux_sysctl, return, ENOTDIR); return (ENOTDIR); Modified: stable/10/sys/compat/linux/linux_uid16.c ============================================================================== --- stable/10/sys/compat/linux/linux_uid16.c Sat Jan 9 16:16:16 2016 (r293531) +++ stable/10/sys/compat/linux/linux_uid16.c Sat Jan 9 16:20:29 2016 (r293532) @@ -172,12 +172,12 @@ linux_setgroups16(struct thread *td, str LIN_SDT_PROBE1(uid16, linux_setgroups16, return, EINVAL); return (EINVAL); } - linux_gidset = malloc(ngrp * sizeof(*linux_gidset), M_TEMP, M_WAITOK); + linux_gidset = malloc(ngrp * sizeof(*linux_gidset), M_LINUX, M_WAITOK); error = copyin(args->gidset, linux_gidset, ngrp * sizeof(l_gid16_t)); if (error) { LIN_SDT_PROBE1(uid16, linux_setgroups16, copyin_error, error); LIN_SDT_PROBE1(uid16, linux_setgroups16, return, error); - free(linux_gidset, M_TEMP); + free(linux_gidset, M_LINUX); return (error); } newcred = crget(); @@ -219,7 +219,7 @@ linux_setgroups16(struct thread *td, str crfree(oldcred); error = 0; out: - free(linux_gidset, M_TEMP); + free(linux_gidset, M_LINUX); LIN_SDT_PROBE1(uid16, linux_setgroups16, return, error); return (error); @@ -260,14 +260,14 @@ linux_getgroups16(struct thread *td, str ngrp = 0; linux_gidset = malloc(bsd_gidsetsz * sizeof(*linux_gidset), - M_TEMP, M_WAITOK); + M_LINUX, M_WAITOK); while (ngrp < bsd_gidsetsz) { linux_gidset[ngrp] = bsd_gidset[ngrp + 1]; ngrp++; } error = copyout(linux_gidset, args->gidset, ngrp * sizeof(l_gid16_t)); - free(linux_gidset, M_TEMP); + free(linux_gidset, M_LINUX); if (error) { LIN_SDT_PROBE1(uid16, linux_getgroups16, copyout_error, error); LIN_SDT_PROBE1(uid16, linux_getgroups16, return, error); Modified: stable/10/sys/compat/linux/linux_util.c ============================================================================== --- stable/10/sys/compat/linux/linux_util.c Sat Jan 9 16:16:16 2016 (r293531) +++ stable/10/sys/compat/linux/linux_util.c Sat Jan 9 16:20:29 2016 (r293532) @@ -55,6 +55,8 @@ __FBSDID("$FreeBSD$"); #include MALLOC_DEFINE(M_LINUX, "linux", "Linux mode structures"); +MALLOC_DEFINE(M_FUTEX, "futex", "Linux futexes"); +MALLOC_DEFINE(M_FUTEX_WP, "futex wp", "Linux futex waiting proc"); const char linux_emul_path[] = "/compat/linux"; Modified: stable/10/sys/compat/linux/linux_util.h ============================================================================== --- stable/10/sys/compat/linux/linux_util.h Sat Jan 9 16:16:16 2016 (r293531) +++ stable/10/sys/compat/linux/linux_util.h Sat Jan 9 16:20:29 2016 (r293532) @@ -45,6 +45,8 @@ #include MALLOC_DECLARE(M_LINUX); +MALLOC_DECLARE(M_FUTEX); +MALLOC_DECLARE(M_FUTEX_WP); extern const char linux_emul_path[];