public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jeff Law <law@redhat.com>
To: "Martin Liška" <mliska@suse.cz>, "GCC Patches" <gcc-patches@gcc.gnu.org>
Cc: Jan Hubicka <hubicka@ucw.cz>
Subject: Re: [PATCH 1/3] Support new mallinfo2 function.
Date: Thu, 17 Sep 2020 15:56:00 -0600	[thread overview]
Message-ID: <8e6f6f40-66bf-9368-40aa-4e2f24c31f64@redhat.com> (raw)
In-Reply-To: <9e6f570e-77f1-eb4e-f401-1cdd848a8af7@suse.cz>

[-- Attachment #1: Type: text/plain, Size: 4899 bytes --]


On 9/2/20 7:28 AM, Martin Liška wrote:
> On 9/1/20 2:31 PM, Martin Liška wrote:
>> Hey.
>>
>> I've just applied to patches to glibc introducing a new mallinfo2
>> function.
>> Limitation of the current function mallinfo is usage of int type
>> which overflows
>> for allocation > 2GB.
>>
>> The patch adds configure detection and usage of the new one. And it
>> prints heap usage
>> in MiB.
>>
>> Ready to be installed after tests?
>> Thanks,
>> Martin
>
> All right, there's V2 where I just support mallinfo2.
>
> Martin
>
> 0001-Support-new-mallinfo2-function.patch
>
> From bdb6dcf8fbd51a9dc62e6a50a7eeedc734c130f9 Mon Sep 17 00:00:00 2001
> From: Martin Liska <mliska@suse.cz>
> Date: Tue, 1 Sep 2020 14:14:45 +0200
> Subject: [PATCH 1/3] Support new mallinfo2 function.
>
> gcc/ChangeLog:
>
> 	* config.in: Regenerate.
> 	* configure: Likewise.
> 	* configure.ac: Detect for mallinfo2.
> 	* ggc-common.c (defined): Use it.
> 	* system.h: Handle also HAVE_MALLINFO2.
> ---
>  gcc/config.in    | 16 ++++++++++++++--
>  gcc/configure    |  4 ++--
>  gcc/configure.ac |  4 ++--
>  gcc/ggc-common.c | 12 +++++++++---
>  gcc/system.h     |  2 +-
>  5 files changed, 28 insertions(+), 10 deletions(-)
>
> diff --git a/gcc/config.in b/gcc/config.in
> index 478e74fac02..1832c112ed9 100644
> --- a/gcc/config.in
> +++ b/gcc/config.in
> @@ -983,13 +983,19 @@
>  #endif
>  
>  
> -/* Define to 1 if we found a declaration for 'mallinfo', otherwise define to
> -   0. */
> +/* Define to 1 if we found a declaration for 'mallinfo */
>  #ifndef USED_FOR_TARGET
>  #undef HAVE_DECL_MALLINFO
>  #endif
>  
>  
> +/* Define to 1 if we found a declaration for 'mallinfo2', otherwise define to
> +   0. */
> +#ifndef USED_FOR_TARGET
> +#undef HAVE_DECL_MALLINFO2
> +#endif
> +
> +
>  /* Define to 1 if we found a declaration for 'malloc', otherwise define to 0.
>     */
>  #ifndef USED_FOR_TARGET
> @@ -1665,6 +1671,12 @@
>  #endif
>  
>  
> +/* Define to 1 if you have the `mallinfo2' function. */
> +#ifndef USED_FOR_TARGET
> +#undef HAVE_MALLINFO2
> +#endif
> +
> +
>  /* Define to 1 if you have the <malloc.h> header file. */
>  #ifndef USED_FOR_TARGET
>  #undef HAVE_MALLOC_H
> diff --git a/gcc/configure b/gcc/configure
> index 0f7a8dbe0f9..b8b9bd3505b 100755
> --- a/gcc/configure
> +++ b/gcc/configure
> @@ -10120,7 +10120,7 @@ fi
>  for ac_func in times clock kill getrlimit setrlimit atoq \
>  	popen sysconf strsignal getrusage nl_langinfo \
>  	gettimeofday mbstowcs wcswidth mmap setlocale \
> -	clearerr_unlocked feof_unlocked   ferror_unlocked fflush_unlocked fgetc_unlocked fgets_unlocked   fileno_unlocked fprintf_unlocked fputc_unlocked fputs_unlocked   fread_unlocked fwrite_unlocked getchar_unlocked getc_unlocked   putchar_unlocked putc_unlocked madvise mallinfo
> +	clearerr_unlocked feof_unlocked   ferror_unlocked fflush_unlocked fgetc_unlocked fgets_unlocked   fileno_unlocked fprintf_unlocked fputc_unlocked fputs_unlocked   fread_unlocked fwrite_unlocked getchar_unlocked getc_unlocked   putchar_unlocked putc_unlocked madvise mallinfo mallinfo2
>  do :
>    as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
>  ac_fn_cxx_check_func "$LINENO" "$ac_func" "$as_ac_var"
> @@ -11549,7 +11549,7 @@ fi
>  done
>  
>  
> -for ac_func in mallinfo
> +for ac_func in mallinfo, mallinfo2
>  do
>    ac_tr_decl=`$as_echo "HAVE_DECL_$ac_func" | $as_tr_cpp`
>  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $ac_func is declared" >&5
> diff --git a/gcc/configure.ac b/gcc/configure.ac
> index 0f11238c19f..18640fdb8a5 100644
> --- a/gcc/configure.ac
> +++ b/gcc/configure.ac
> @@ -1408,7 +1408,7 @@ define(gcc_UNLOCKED_FUNCS, clearerr_unlocked feof_unlocked dnl
>  AC_CHECK_FUNCS(times clock kill getrlimit setrlimit atoq \
>  	popen sysconf strsignal getrusage nl_langinfo \
>  	gettimeofday mbstowcs wcswidth mmap setlocale \
> -	gcc_UNLOCKED_FUNCS madvise mallinfo)
> +	gcc_UNLOCKED_FUNCS madvise mallinfo mallinfo2)
>  
>  if test x$ac_cv_func_mbstowcs = xyes; then
>    AC_CACHE_CHECK(whether mbstowcs works, gcc_cv_func_mbstowcs_works,
> @@ -1488,7 +1488,7 @@ gcc_AC_CHECK_DECLS(getrlimit setrlimit getrusage, , ,[
>  #endif
>  ])
>  
> -gcc_AC_CHECK_DECLS(mallinfo, , ,[
> +gcc_AC_CHECK_DECLS([mallinfo, mallinfo2], , ,[
>  #include "ansidecl.h"
>  #include "system.h"
>  #ifdef HAVE_MALLOC_H
> diff --git a/gcc/ggc-common.c b/gcc/ggc-common.c
> index 94da02f1185..b8782c5824b 100644
> --- a/gcc/ggc-common.c
> +++ b/gcc/ggc-common.c
> @@ -1008,13 +1008,19 @@ ggc_prune_overhead_list (void)
>        }
>  }
>  
> -/* Return memory used by heap in kb, 0 if this info is not available.  */
> +/* Print memory used by heap in kb if this info is not available.  */

This comment seems wrong...  OK with the comment fixed.


jeff



[-- Attachment #2: pEpkey.asc --]
[-- Type: application/pgp-keys, Size: 1763 bytes --]

      reply	other threads:[~2020-09-17 21:56 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-01 12:31 Martin Liška
2020-09-01 12:32 ` [PATCH 2/3] Use MiB unit when displaying memory allocation Martin Liška
2020-09-01 14:04   ` Jan Hubicka
2020-09-02 13:28     ` Martin Liška
2020-09-17 21:57       ` Jeff Law
2020-09-22  7:47       ` Christophe Lyon
2020-09-22  8:30         ` Martin Liška
2020-09-22 13:02           ` Marek Polacek
2020-09-22 13:24             ` Marek Polacek
2020-09-01 12:33 ` [PATCH 3/3] Use more ONE_? in GGC functions Martin Liška
2020-09-02 13:29   ` Martin Liška
2020-09-17 21:57     ` Jeff Law
2020-09-01 13:38 ` [PATCH 4/N] Change timevar memory allocation to MiB Martin Liška
2020-09-02 13:29   ` Martin Liška
2020-09-02 13:28 ` [PATCH 1/3] Support new mallinfo2 function Martin Liška
2020-09-17 21:56   ` Jeff Law [this message]

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=8e6f6f40-66bf-9368-40aa-4e2f24c31f64@redhat.com \
    --to=law@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=hubicka@ucw.cz \
    --cc=mliska@suse.cz \
    /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).