From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.2 required=3.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id D47C31FAF0 for ; Wed, 30 Nov 2022 21:08:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=80x24.org; s=selector1; t=1669842517; bh=JlLiH13cJ4gs+ycWUfAbATJHqujjw9wSztuWQv968aA=; h=From:To:Subject:Date:In-Reply-To:References:From; b=2GO1i5p/vu0gx00FJ/vl/JdpFHw4GBtI6v/xeXeMSJ9gTOH6F5DPkW6rWVDDkzKsH GW8c8pY46VjpRX0rA3PVT8NyoP6QqKMO3Ad0jutYH600pmBgf0OOqvi/K+JGbiFKpK 70oymbICga1xwWlVAuSDIL/6zVufJB0vyWMdIkHk= From: Eric Wong To: mwrap-perl@80x24.org Subject: [PATCH v2 2/2] increase DEFAULT_GRANULARITY to 64M Date: Wed, 30 Nov 2022 21:08:37 +0000 Message-Id: <20221130210837.17163-3-e@80x24.org> In-Reply-To: <20221130210837.17163-1-e@80x24.org> References: <20221130210837.17163-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: Since Linux maps are file-backed, it won't provide an increase in physical memory. Using larger chunks reduces syscalls and avoids hitting the Linux system-wide /proc/sys/vm/max_map_count limit. It's probably safe for all x86-64 systems these days, and 32-bit is prone to overflow and not a target of this project (though this project aims to make other projects suitable for underpowered 32-bit systems). --- mymalloc.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mymalloc.h b/mymalloc.h index 88190d5..94f2c7a 100644 --- a/mymalloc.h +++ b/mymalloc.h @@ -29,6 +29,9 @@ #include #include +/* this is fine on most x86-64, especially with file-backed mmap(2) */ +#define DEFAULT_GRANULARITY (64U * 1024U * 1024U) + #if !defined(MWRAP_FILE_BACKED) && defined(__linux__) && defined(O_TMPFILE) # define MWRAP_FILE_BACKED 1 #else