From owner-freebsd-hackers@FreeBSD.ORG Mon Nov 3 03:41:03 2014 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id AF980A26 for ; Mon, 3 Nov 2014 03:41:03 +0000 (UTC) Received: from mail-la0-x22a.google.com (mail-la0-x22a.google.com [IPv6:2a00:1450:4010:c03::22a]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 33E0DD16 for ; Mon, 3 Nov 2014 03:41:03 +0000 (UTC) Received: by mail-la0-f42.google.com with SMTP id gq15so8945806lab.1 for ; Sun, 02 Nov 2014 19:41:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:from:reply-to:to:subject:date:mime-version:content-type :thread-index:content-language; bh=S8vtFJ4Xy7PIIqLBOkAQ5BD0MrYRewBxVAIRJ9rqMeM=; b=m9KLDteSYcmAKZBHyHM3dL89JzqtjnzUIkdJl8GZGS+v3iJk08j/8jYMF+0smLmEFu tn4lLmh082qQky3JeH2vvKvr2s0IuPtyQSzarLdHVoW6p7OuFb/RWJVUdZxP4UNxcgiB hQsOag41J4qFtBlatbKG3fCOk5v7TdeHqAk9XrExWGxQmIU5IPjbZWFPV+XXnm1E1Q5L BfNMAEE+XSDwg7BKkqOs3ZP86MMgSrrb+2L6ObzgRYGvdl4eDKLYKZx7f48+0s7C9YGI /55Dlbo+aVo2nkf9tU/j2V2WxI8erGFkZOUsu5Mu1mypBvYorCOEKfs8EllgHNzgWSX8 zzuw== X-Received: by 10.112.139.165 with SMTP id qz5mr9414241lbb.96.1414986061144; Sun, 02 Nov 2014 19:41:01 -0800 (PST) Received: from rimwks1w7x64 ([2001:470:1f15:8e:2497:9687:421b:c20e]) by mx.google.com with ESMTPSA id mn4sm7422492lbb.4.2014.11.02.19.40.58 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 02 Nov 2014 19:41:00 -0800 (PST) Message-ID: <5456f94c.247d700a.771d.ffff869e@mx.google.com> X-Google-Original-Message-ID: <007101cff717$fbd14c60$f373e520$@IM@gmail.com> From: rozhuk.im@gmail.com X-Google-Original-From: Reply-To: To: Subject: pagedaemon + rtorrent = fail Date: Mon, 3 Nov 2014 06:40:57 +0300 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_NextPart_000_0072_01CFF731.211E8460" X-Mailer: Microsoft Office Outlook 12.0 Thread-Index: Ac/3F/pkV86unfLIRj2GXhwrU20Enw== Content-Language: ru X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Nov 2014 03:41:03 -0000 This is a multi-part message in MIME format. ------=_NextPart_000_0072_01CFF731.211E8460 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Problem described here: https://forums.freebsd.org/threads/heavy-use-rtorrent-ufs-issues.14503/ http://www.bsdportal.ru/viewtopic.php?f=9&t=25194 http://forum.lissyara.su/viewtopic.php?f=53&t=39944 Swap is off: vm.swap_enabled=0 and no swap devices. I wrote a small program to demonstrate the problem. The program creates a file size of 2*"RAM size", map() block size specified, records in each page by byte, unmap(), map() next block... Once a file is written to more "RAM size" OOM kills the program and random demons. In the TOP program does not consume more than the write_block size (32 mb) for recording. Check the parameters before the test run. ------=_NextPart_000_0072_01CFF731.211E8460 Content-Type: text/plain; name="testvm.c" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="testvm.c" =0A= /* rtorrent + FreeBSD pagedaemon prombel simulator=0A= * 2014 Rozhuk Ivan =0A= *=0A= * compile-command: "clang -Wall -O2 -o testvm testvm.c"=0A= */=0A= =0A= =0A= #include =0A= #include =0A= #include // chmod, fchmod, umask=0A= #include /* readv, preadv, writev, pwritev */=0A= #include /* mmap, munmap */=0A= =0A= #include =0A= #include /* open, fcntl */=0A= #include /* snprintf, fprintf */=0A= #include /* bcopy, bzero, memcpy, memmove, memset, strnlen, = strerror... */=0A= #include /* close, write, sysconf */=0A= #include /* malloc, exit */=0A= =0A= #define LOG_ERR(error, descr) \=0A= fprintf(stdout, "fn: %s, line: %i, error: %i - %s, %s\n", \=0A= __FUNCTION__, __LINE__, error, strerror(error), descr);=0A= =0A= int=0A= main(int argc, char *argv[]) {=0A= int error =3D 0, fd;=0A= const char *file_name =3D (const char *)"/testvn.tmp";=0A= off_t mb =3D (1024 * 1024); /* 1 megabyte. */=0A= off_t file_size =3D (10 * 1024 * mb); /* Set to x2 RAM size. */=0A= off_t write_size =3D (32 * mb); /* Write block size. */=0A= off_t i, j, page_size;=0A= uint8_t *mem;=0A= =0A= fd =3D open(file_name, (O_RDWR | O_CREAT), 0600);=0A= if (-1 =3D=3D fd) {=0A= error =3D errno;=0A= LOG_ERR(error, "open()");=0A= goto err_out;=0A= }=0A= if (0 !=3D flock(fd, LOCK_EX)) {=0A= error =3D errno;=0A= LOG_ERR(error, "flock()");=0A= goto err_out;=0A= }=0A= if (0 !=3D ftruncate(fd, file_size)) {=0A= error =3D errno;=0A= LOG_ERR(error, "ftruncate()");=0A= goto err_out;=0A= }=0A= =0A= page_size =3D sysconf(_SC_PAGE_SIZE);=0A= for (i =3D 0; i < (file_size / write_size); i ++) {=0A= mem =3D mmap(NULL, write_size, (PROT_READ | PROT_WRITE),=0A= (MAP_SHARED | MAP_NOCORE), fd, (i * write_size));=0A= if (MAP_FAILED =3D=3D mem) {=0A= error =3D errno;=0A= LOG_ERR(error, "mmap()");=0A= goto err_out;=0A= }=0A= for (j =3D 0; j < (write_size / page_size); j ++) {=0A= mem[(j * page_size)] =3D 1;=0A= }=0A= munmap(mem, file_size);=0A= }=0A= =0A= err_out:=0A= close(fd);=0A= //unlink(file_name); /* Delete file to free all mem. */=0A= =0A= return (error);=0A= }=0A= ------=_NextPart_000_0072_01CFF731.211E8460--