public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Florian Weimer <fweimer@redhat.com>
To: Cupertino Miranda via Libc-alpha <libc-alpha@sourceware.org>
Cc: Cupertino Miranda <cupertino.miranda@oracle.com>,
	jose.marchesi@oracle.com,  elena.zannoni@oracle.com,
	adhemerval.zanella@linaro.org
Subject: Re: [PATCH] Created tunable to force small pages on stack allocation.
Date: Mon, 13 Mar 2023 08:54:46 +0100	[thread overview]
Message-ID: <87edptulvd.fsf@oldenburg.str.redhat.com> (raw)
In-Reply-To: <20230310143558.361825-2-cupertino.miranda@oracle.com> (Cupertino Miranda via Libc-alpha's message of "Fri, 10 Mar 2023 14:35:58 +0000")

* Cupertino Miranda via Libc-alpha:

> +static void
> +TUNABLE_CALLBACK (set_stack_hugetlb) (tunable_val_t *valp)
> +{
> +  enum malloc_thp_mode_t thp_mode = __malloc_thp_mode ();
> +  /*
> +     Only allow to change the default of this tunable if the system
> +     does support and has either 'madvise' or 'always' mode. Otherwise
> +     the madvise() call is wasteful.
> +  */
> +  switch(thp_mode)
> +    {
> +    case malloc_thp_mode_always:
> +    case malloc_thp_mode_madvise:
> +      __nptl_stack_hugetlb = (int32_t) valp->numval;
> +      break;
> +    default:
> +      break;
> +    }
> +}

I suspect that quite a few failing madvise calls are cheaper than the
those three system calls in __malloc_thp_mode.  In addition,
__malloc_thp_mode may fail due to future kernel changes, disabling the
tunable by accident.

Thanks,
Florian


  reply	other threads:[~2023-03-13  7:54 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-10 14:35 Cupertino Miranda
2023-03-10 14:35 ` Cupertino Miranda
2023-03-13  7:54   ` Florian Weimer [this message]
2023-03-13 10:07     ` Cupertino Miranda
2023-03-13 17:10       ` Cupertino Miranda
2023-03-13 17:18         ` Cupertino Miranda
2023-03-13 17:15       ` Adhemerval Zanella Netto
2023-03-13 17:32         ` Cupertino Miranda
2023-03-13 17:17     ` Cupertino Miranda
2023-03-20 15:41 [v2] Created tunable to force small pages on stack Cupertino Miranda
2023-03-20 15:41 ` [PATCH] Created tunable to force small pages on stack allocation Cupertino Miranda

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=87edptulvd.fsf@oldenburg.str.redhat.com \
    --to=fweimer@redhat.com \
    --cc=adhemerval.zanella@linaro.org \
    --cc=cupertino.miranda@oracle.com \
    --cc=elena.zannoni@oracle.com \
    --cc=jose.marchesi@oracle.com \
    --cc=libc-alpha@sourceware.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.
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).