mwrap user+dev discussion/patches/pulls/bugs/help
 help / color / Atom feed
From: Eric Wong <e@80x24.org>
To: <mwrap-public@80x24.org>
Subject: [PATCH] remove "memalign:" MWRAP option
Date: Fri, 10 Aug 2018 07:08:43 +0000
Message-ID: <20180810070843.30290-1-e@80x24.org> (raw)

Since we learned to treat heap_page_body allocations specially,
we can also keep track of rare memalign allocations done outside
of the Ruby GC this way.
---
 ext/mwrap/mwrap.c | 16 +---------------
 1 file changed, 1 insertion(+), 15 deletions(-)

diff --git a/ext/mwrap/mwrap.c b/ext/mwrap/mwrap.c
index 29cfc11..c44ea89 100644
--- a/ext/mwrap/mwrap.c
+++ b/ext/mwrap/mwrap.c
@@ -23,7 +23,6 @@
 #include "jhash.h"
 
 static ID id_uminus;
-static unsigned int track_memalign;
 const char *rb_source_location_cstr(int *line); /* requires 2.6.0dev */
 extern int __attribute__((weak)) ruby_thread_has_gvl_p(void);
 extern void * __attribute__((weak)) ruby_current_execution_context_ptr;
@@ -152,10 +151,6 @@ __attribute__((constructor)) static void resolve_malloc(void)
 		fprintf(stderr, "pthread_atfork failed: %s\n", strerror(err));
 	page_size = sysconf(_SC_PAGESIZE);
 	opt = getenv("MWRAP");
-	if (opt && (opt = strstr(opt, "memalign:"))) {
-		if (!sscanf(opt, "memalign:%u", &track_memalign))
-			fprintf(stderr, "not an unsigned int: %s\n", opt);
-	}
 	--locating;
 }
 
@@ -575,10 +570,8 @@ internal_memalign(void **pp, size_t alignment, size_t size, uintptr_t caller)
 	if (alignment == HEAP_PAGE_ALIGN && size == HEAP_PAGE_SIZE) {
 		if (has_ec_p()) generation = rb_gc_count();
 		l = IS_HEAP_PAGE_BODY;
-	} else if (track_memalign) {
-		l = update_stats_rcu_lock(size, caller);
 	} else {
-		l = 0;
+		l = update_stats_rcu_lock(size, caller);
 	}
 
 	if (l == IS_HEAP_PAGE_BODY) {
@@ -1285,16 +1278,9 @@ static VALUE hpb_stat(int argc, VALUE *argv, VALUE hpb)
  * * dump_fd: a writable FD to dump to
  * * dump_path: a path to dump to, the file is opened in O_APPEND mode
  * * dump_min: the minimum allocation size (total) to dump
- * * memalign: use `1' to enable tracking the memalign family
  *
  * If both `dump_fd' and `dump_path' are specified, dump_path takes
  * precedence.
- *
- * Tracking the memalign family of functions is misleading for Ruby
- * applications, as heap page allocations can happen anywhere a
- * Ruby object is allocated, even in the coldest code paths.
- * Furthermore, it is rarely-used outside of the Ruby object allocator.
- * Thus tracking memalign functions is disabled by default.
  */
 void Init_mwrap(void)
 {
-- 
EW


             reply index

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-10  7:08 Eric Wong [this message]
2018-08-10  7:10 ` [PATCH v2] " 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

  List information: https://80x24.org/mwrap/

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

  git send-email \
    --in-reply-to=20180810070843.30290-1-e@80x24.org \
    --to=e@80x24.org \
    --cc=mwrap-public@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

mwrap user+dev discussion/patches/pulls/bugs/help

Archives are clonable:
	git clone --mirror https://80x24.org/mwrap-public/0 mwrap-public/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 mwrap-public mwrap-public/ https://80x24.org/mwrap-public \
		mwrap-public@80x24.org
	public-inbox-index mwrap-public

Example config snippet for mirrors

Newsgroups are available over NNTP:
	nntp://news.public-inbox.org/inbox.comp.lang.ruby.mwrap
	nntp://ou63pmih66umazou.onion/inbox.comp.lang.ruby.mwrap

 note: .onion URLs require Tor: https://www.torproject.org/

AGPL code for this site: git clone https://public-inbox.org/public-inbox.git