From owner-freebsd-questions@freebsd.org Thu Jun 2 19:21:01 2016 Return-Path: Delivered-To: freebsd-questions@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 C733CB65FCF for ; Thu, 2 Jun 2016 19:21:01 +0000 (UTC) (envelope-from artem@artem.ru) Received: from fallback2.mail.ru (fallback2.mail.ru [94.100.179.22]) by mx1.freebsd.org (Postfix) with ESMTP id BABDA1EDF for ; Thu, 2 Jun 2016 19:21:00 +0000 (UTC) (envelope-from artem@artem.ru) Received: from smtp29.i.mail.ru (smtp29.i.mail.ru [94.100.177.89]) by fallback2.mail.ru (mPOP.Fallback_MX) with ESMTP id AEDBA1025BDD1 for ; Thu, 2 Jun 2016 20:52:43 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mail.ru; s=mail2; h=Content-Transfer-Encoding:Content-Type:MIME-Version:Date:Message-ID:Subject:From:To; bh=Niq7MNe4MT44qsJQjFrS98VfxyEFRQtMHDomvAvcAG0=; b=PTYJGKbzwRf6WlEwZFlQj2o/BLjj/jQQUFFGGoqVlyNOsG0DiOQIpeCNp3eATKb1FpZkyyKreCIo/+37Thy6lT14XVMzis0xxVJLcVUzo/XKl0ZHVv4WK8wlStCqmUKsSeixaZJDGPr5kRnu6S0JHGV10TZFlU13H8C30JEbwPM=; Received: from [109.188.127.87] (port=17632 helo=[192.168.0.12]) by smtp29.i.mail.ru with esmtpa (envelope-from ) id 1b8WnK-0000dH-FE for freebsd-questions@freebsd.org; Thu, 02 Jun 2016 20:52:34 +0300 To: FreeBSD Questions Mailing List From: Artem Kuchin Subject: rctl memory usage count and swap Message-ID: <60ecb4a9-c3c5-6bfd-e032-21fa5f03c85a@artem.ru> Date: Thu, 2 Jun 2016 20:52:38 +0300 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.1.1 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Mras: OK X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Jun 2016 19:21:01 -0000 Hello freebsd 10.2 I have apache in jail, each apache in running under its own user, so, i have many user in one jail and many httpd processed started under that users. I wanted to limit memory usage per user and disable swap for all of them. So, i use rctl I try such rules vmemoryuse:log=1g swapuse:log=0 Now two problem appeared immediately 1) VMEMORYUSE I see messages in log file like this kernel: rctl: rule "user:17032:vmemoryuse:log=1073741824" matched by pid 40360 (httpd), uid 17032, jail XXX So, it seems like user overused memory, i check # rctl -u user:17032 cputime=37 datasize=368640 stacksize=0 coredumpsize=0 memoryuse=329007104 memorylocked=0 maxproc=10 openfiles=320 vmemoryuse=4147863552 pseudoterminals=0 swapuse=6148096 nthr=9 msgqqueued=0 msgqsize=0 nmsgq=0 nsem=0 nsemop=0 nshm=0 shmsize=0 wallclock=28270 pcpu=0 Aha, seems like the user used 4G of virtual memory and 329M of real memory No lets see its processes 17032 2213 1 0 21 0 446372 27808 select SsJ - 0:02.47 /usr/local/sbin/httpd 17032 30173 2213 0 20 0 450468 39644 accept IJ - 0:00.29 /usr/local/sbin/httpd 17032 39611 2213 0 20 0 450468 37160 accept IJ - 0:00.06 /usr/local/sbin/httpd 17032 39612 2213 0 20 0 450468 36712 accept IJ - 0:00.05 /usr/local/sbin/httpd 17032 39613 2213 0 20 0 450468 36608 accept IJ - 0:00.06 /usr/local/sbin/httpd 17032 39614 2213 0 20 0 450468 36624 accept IJ - 0:00.05 /usr/local/sbin/httpd 17032 39617 2213 0 20 0 450468 37144 accept IJ - 0:00.03 /usr/local/sbin/httpd 17032 39618 2213 0 20 0 450468 36268 accept SJ - 0:00.04 /usr/local/sbin/httpd 17032 39619 2213 0 20 0 450468 36432 accept IJ - 0:00.05 /usr/local/sbin/httpd 17032 39621 2213 0 20 0 450468 36332 accept IJ - 0:00.04 /usr/local/sbin/httpd 17032 39623 2213 0 20 0 450468 36988 accept IJ - 0:00.06 /usr/local/sbin/httpd 17032 39624 2213 0 20 0 450468 36212 accept IJ - 0:00.03 /usr/local/sbin/httpd 17032 39626 2213 0 20 0 450468 36544 accept IJ - 0:00.04 /usr/local/sbin/httpd 17032 39627 2213 0 20 0 450468 37360 accept IJ - 0:00.06 /usr/local/sbin/httpd 17032 39628 2213 0 20 0 450468 36772 accept IJ - 0:00.04 /usr/local/sbin/httpd 17032 39633 2213 0 20 0 450468 34972 accept IJ - 0:00.04 /usr/local/sbin/httpd 17032 39634 2213 0 20 0 450468 36104 accept IJ - 0:00.03 /usr/local/sbin/httpd 17032 39635 2213 0 20 0 450468 35784 accept IJ - 0:00.03 /usr/local/sbin/httpd 17032 39637 2213 0 20 0 450468 36232 accept IJ - 0:00.04 /usr/local/sbin/httpd 17032 39638 2213 0 20 0 450468 36620 accept IJ - 0:00.04 /usr/local/sbin/httpd 17032 39645 2213 0 20 0 450468 36084 accept IJ - 0:00.04 /usr/local/sbin/httpd 17032 39649 2213 0 20 0 450468 36356 accept SJ - 0:00.04 /usr/local/sbin/httpd 17032 39652 2213 0 20 0 450468 36156 accept SJ - 0:00.04 /usr/local/sbin/httpd 17032 39653 2213 0 20 0 450468 35436 accept SJ - 0:00.03 /usr/local/sbin/httpd 17032 39655 2213 0 20 0 450468 37752 accept SJ - 0:00.04 /usr/local/sbin/httpd 17032 39657 2213 0 20 0 450468 35664 accept IJ - 0:00.03 /usr/local/sbin/httpd 17032 39661 2213 0 20 0 450468 36228 accept SJ - 0:00.04 /usr/local/sbin/httpd As you see the virtual memory is 100% shared and RSS is at most 930M Where rctl gets its number? memoryuse=329007104 vmemoryuse=4147863552 2) swapuse:log=0 This rule create strange problems (when used with deny) Jun 2 20:24:57 omni kernel: rctl: rule "user:17094:swapuse:log=0" matched by pid 27553 (httpd), uid 17094, jail XXXX Jun 2 20:24:57 omni kernel: kern.ipc.maxpipekva exceeded; see tuning(7) As you see from rctl -u it shows swapuse=6148096 but! # swapinfo Device 1K-blocks Used Avail Capacity /dev/mirror/swap 4194300 0 4194300 0% So, not swap is really used But even if i do swapuse:log=300M i get the same error And what maxpopekva has to do with it? Is rctl really usable in 10.2 ?