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 [216.205.24.124]) by sourceware.org (Postfix) with ESMTP id 4757D3854813 for ; Thu, 24 Jun 2021 23:34:04 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 4757D3854813 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-309-yr5pE9zRMuymX4bMbh8KOg-1; Thu, 24 Jun 2021 19:34:02 -0400 X-MC-Unique: yr5pE9zRMuymX4bMbh8KOg-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 881C318414A8; Thu, 24 Jun 2021 23:34:01 +0000 (UTC) Received: from greed.delorie.com (ovpn-112-111.rdu2.redhat.com [10.10.112.111]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 01B56604CD; Thu, 24 Jun 2021 23:33:57 +0000 (UTC) Received: from greed.delorie.com.redhat.com (localhost [127.0.0.1]) by greed.delorie.com (8.15.2/8.15.2) with ESMTP id 15ONXugn448667; Thu, 24 Jun 2021 19:33:56 -0400 From: DJ Delorie To: Siddhesh Poyarekar Cc: libc-alpha@sourceware.org, carlos@redhat.com, fweimer@redhat.com Subject: Re: [PATCH 7/8] Remove __after_morecore_hook In-Reply-To: <20210624182312.236596-8-siddhesh@sourceware.org> Date: Thu, 24 Jun 2021 19:33:56 -0400 Message-ID: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain X-Spam-Status: No, score=-12.7 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Jun 2021 23:34:05 -0000 Siddhesh Poyarekar writes: > Remove __after_morecore_hook from the API and finalize the symbol so > that it can no longer be used in new applications. Old applications > using __after_morecore_hook will find that their hook is no longer > called. > diff --git a/malloc/hooks.c b/malloc/hooks.c > index cc9ffc8b63..fa6b3f4c16 100644 > --- a/malloc/hooks.c > +++ b/malloc/hooks.c > @@ -78,6 +78,9 @@ compat_symbol (libc, __malloc_hook, __malloc_hook, GLIBC_2_0); > compat_symbol (libc, __realloc_hook, __realloc_hook, GLIBC_2_0); > compat_symbol (libc, __memalign_hook, __memalign_hook, GLIBC_2_0); > > +void weak_variable (*__after_morecore_hook) (void) = NULL; > +compat_symbol (libc, __after_morecore_hook, __after_morecore_hook, GLIBC_2_0); > + Ok. > diff --git a/malloc/malloc.c b/malloc/malloc.c > index 16ad933c66..51970105b5 100644 > --- a/malloc/malloc.c > +++ b/malloc/malloc.c > @@ -1988,16 +1988,6 @@ static void malloc_consolidate (mstate); > > /* -------------- Early definitions for debugging hooks ---------------- */ > > -/* Define and initialize the hook variables. These weak definitions must > - appear before any use of the variables in a function (arena.c uses one). */ > -#ifndef weak_variable > -/* In GNU libc we want the hook variables to be weak definitions to > - avoid a problem with Emacs. */ > -# define weak_variable weak_function > -#endif > - > -void weak_variable (*__after_morecore_hook) (void) = NULL; > - Ok. > @@ -2622,14 +2612,7 @@ sysmalloc (INTERNAL_SIZE_T nb, mstate av) > LIBC_PROBE (memory_sbrk_more, 2, brk, size); > } > > - if (brk != (char *) (MORECORE_FAILURE)) > - { > - /* Call the `morecore' hook if necessary. */ > - void (*hook) (void) = atomic_forced_read (__after_morecore_hook); > - if (__builtin_expect (hook != NULL, 0)) > - (*hook)(); > - } > - else > + if (brk == (char *) (MORECORE_FAILURE)) Ok. > @@ -2768,13 +2751,6 @@ sysmalloc (INTERNAL_SIZE_T nb, mstate av) > correction = 0; > snd_brk = (char *) (MORECORE (0)); > } > - else > - { > - /* Call the `morecore' hook if necessary. */ > - void (*hook) (void) = atomic_forced_read (__after_morecore_hook); > - if (__builtin_expect (hook != NULL, 0)) > - (*hook)(); > - } Ok. > @@ -2933,10 +2909,6 @@ systrim (size_t pad, mstate av) > */ > > MORECORE (-extra); > - /* Call the `morecore' hook if necessary. */ > - void (*hook) (void) = atomic_forced_read (__after_morecore_hook); > - if (__builtin_expect (hook != NULL, 0)) > - (*hook)(); > new_brk = (char *) (MORECORE (0)); Ok. > diff --git a/malloc/malloc.h b/malloc/malloc.h > index 709fa454b5..d066a05d82 100644 > --- a/malloc/malloc.h > +++ b/malloc/malloc.h > @@ -164,10 +164,5 @@ extern void malloc_stats (void) __THROW; > /* Output information about state of allocator to stream FP. */ > extern int malloc_info (int __options, FILE *__fp) __THROW; > > -/* Hooks for debugging and user-defined versions. */ > -extern void (*__MALLOC_HOOK_VOLATILE __after_morecore_hook) (void) > - __MALLOC_DEPRECATED; > - > - > __END_DECLS > #endif /* malloc.h */ Ok. LGTM Reviewed-by: DJ Delorie