mwrap (Perl version) user+dev discussion/patches/pulls/bugs/help
 help / color / mirror / code / Atom feed
From: Eric Wong <e@80x24.org>
To: mwrap-perl@80x24.org
Subject: [PATCH 2/2] increase DEFAULT_GRANULARITY to 64M
Date: Wed, 30 Nov 2022 06:49:30 +0000	[thread overview]
Message-ID: <20221130064930.5239-3-e@80x24.org> (raw)
In-Reply-To: <20221130064930.5239-1-e@80x24.org>

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 f5a171e..024075b 100644
--- a/mymalloc.h
+++ b/mymalloc.h
@@ -29,6 +29,9 @@
 #include <fcntl.h>
 #include <errno.h>
 
+/* 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

  parent reply	other threads:[~2022-11-30  6:49 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-30  6:49 [PATCH 0/2] support file-backed mmap on Linux Eric Wong
2022-11-30  6:49 ` [PATCH 1/2] use " Eric Wong
2022-11-30 20:43   ` Eric Wong
2022-11-30  6:49 ` Eric Wong [this message]
2022-11-30 21:08 ` [PATCH v2 0/2] support " Eric Wong
2022-11-30 21:08   ` [PATCH v2 1/2] use " Eric Wong
2022-12-02 10:14     ` Eric Wong
2022-11-30 21:08   ` [PATCH v2 2/2] increase DEFAULT_GRANULARITY to 64M Eric Wong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221130064930.5239-3-e@80x24.org \
    --to=e@80x24.org \
    --cc=mwrap-perl@80x24.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mwrap-perl.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).