From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 34DC13858D32 for ; Mon, 13 Mar 2023 07:54:56 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 34DC13858D32 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678694095; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=bomeCejMhd0BCfE/vb9Nst+UxvrehlotOsifFkY2ex0=; b=cI9DwMUk4G8V5/Wuqdb1vEjW0J7B4waBGsd8TnLmRZ7MZ19Ieqheqkat2qLunC/b7TV1ok CTl6VXBbkCNy8HCP21FvmSeI5hoSx1yL782pN875mJovP+0huaYCGZZ1uYwVK7pzzyrvd3 A6BSzHgUygRWXu+Du+ElWEdVigWwtAM= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-133-61nLji-BNXuEANllqJoWdQ-1; Mon, 13 Mar 2023 03:54:49 -0400 X-MC-Unique: 61nLji-BNXuEANllqJoWdQ-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 4AFED1C27D83; Mon, 13 Mar 2023 07:54:49 +0000 (UTC) Received: from oldenburg.str.redhat.com (unknown [10.2.16.22]) by smtp.corp.redhat.com (Postfix) with ESMTPS id EFF23140E960; Mon, 13 Mar 2023 07:54:47 +0000 (UTC) From: Florian Weimer To: Cupertino Miranda via Libc-alpha Cc: Cupertino Miranda , jose.marchesi@oracle.com, elena.zannoni@oracle.com, adhemerval.zanella@linaro.org Subject: Re: [PATCH] Created tunable to force small pages on stack allocation. References: <20230310143558.361825-1-cupertino.miranda@oracle.com> <20230310143558.361825-2-cupertino.miranda@oracle.com> Date: Mon, 13 Mar 2023 08:54:46 +0100 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") Message-ID: <87edptulvd.fsf@oldenburg.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain X-Spam-Status: No, score=-4.9 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: * 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