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 DFCFD39450CE for ; Thu, 17 Sep 2020 21:56:20 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org DFCFD39450CE 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-543-oqz5rrzsP22ZLj7yLM9-dA-1; Thu, 17 Sep 2020 17:56:03 -0400 X-MC-Unique: oqz5rrzsP22ZLj7yLM9-dA-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C8003801FC6; Thu, 17 Sep 2020 21:56:02 +0000 (UTC) Received: from localhost.localdomain (ovpn-112-142.phx2.redhat.com [10.3.112.142]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0FF1873665; Thu, 17 Sep 2020 21:56:00 +0000 (UTC) Subject: Re: [PATCH 1/3] Support new mallinfo2 function. To: =?UTF-8?Q?Martin_Li=c5=a1ka?= , GCC Patches Cc: Jan Hubicka References: <9e6f570e-77f1-eb4e-f401-1cdd848a8af7@suse.cz> From: Jeff Law Message-ID: <8e6f6f40-66bf-9368-40aa-4e2f24c31f64@redhat.com> Date: Thu, 17 Sep 2020 15:56:00 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <9e6f570e-77f1-eb4e-f401-1cdd848a8af7@suse.cz> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: multipart/mixed; boundary="------------62087D0CDD61AA386DB2BE1E" Content-Language: en-US X-Spam-Status: No, score=-12.5 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, HTML_MESSAGE, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H5, 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-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Sep 2020 21:56:24 -0000 This is a multi-part message in MIME format. --------------62087D0CDD61AA386DB2BE1E Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 9/2/20 7:28 AM, Martin Li=C5=A1ka wrote: > On 9/1/20 2:31 PM, Martin Li=C5=A1ka 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 > Date: Tue, 1 Sep 2020 14:14:45 +0200 > Subject: [PATCH 1/3] Support new mallinfo2 function. > > gcc/ChangeLog: > > =09* config.in: Regenerate. > =09* configure: Likewise. > =09* configure.ac: Detect for mallinfo2. > =09* ggc-common.c (defined): Use it. > =09* 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 > =20 > =20 > -/* Define to 1 if we found a declaration for 'mallinfo', otherwise defin= e to > - 0. */ > +/* Define to 1 if we found a declaration for 'mallinfo */ > #ifndef USED_FOR_TARGET > #undef HAVE_DECL_MALLINFO > #endif > =20 > =20 > +/* Define to 1 if we found a declaration for 'mallinfo2', otherwise defi= ne 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 > =20 > =20 > +/* Define to 1 if you have the `mallinfo2' function. */ > +#ifndef USED_FOR_TARGET > +#undef HAVE_MALLINFO2 > +#endif > + > + > /* Define to 1 if you have the 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 \ > =09popen sysconf strsignal getrusage nl_langinfo \ > =09gettimeofday mbstowcs wcswidth mmap setlocale \ > -=09clearerr_unlocked feof_unlocked ferror_unlocked fflush_unlocked fge= tc_unlocked fgets_unlocked fileno_unlocked fprintf_unlocked fputc_unlocke= d fputs_unlocked fread_unlocked fwrite_unlocked getchar_unlocked getc_unl= ocked putchar_unlocked putc_unlocked madvise mallinfo > +=09clearerr_unlocked feof_unlocked ferror_unlocked fflush_unlocked fge= tc_unlocked fgets_unlocked fileno_unlocked fprintf_unlocked fputc_unlocke= d fputs_unlocked fread_unlocked fwrite_unlocked getchar_unlocked getc_unl= ocked putchar_unlocked putc_unlocked madvise mallinfo mallinfo2 > do : > as_ac_var=3D`$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 > =20 > =20 > -for ac_func in mallinfo > +for ac_func in mallinfo, mallinfo2 > do > ac_tr_decl=3D`$as_echo "HAVE_DECL_$ac_func" | $as_tr_cpp` > { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $ac_func is de= clared" >&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_u= nlocked dnl > AC_CHECK_FUNCS(times clock kill getrlimit setrlimit atoq \ > =09popen sysconf strsignal getrusage nl_langinfo \ > =09gettimeofday mbstowcs wcswidth mmap setlocale \ > -=09gcc_UNLOCKED_FUNCS madvise mallinfo) > +=09gcc_UNLOCKED_FUNCS madvise mallinfo mallinfo2) > =20 > if test x$ac_cv_func_mbstowcs =3D 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 > ]) > =20 > -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) > } > } > =20 > -/* 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...=C2=A0 OK with the comment fixed. jeff --------------62087D0CDD61AA386DB2BE1E Content-Type: application/pgp-keys; name="pEpkey.asc" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="pEpkey.asc" -----BEGIN PGP PUBLIC KEY BLOCK----- mQENBFkbIO8BCACVIqDhDVh9ur8C+zNV1J/cXfwvVDAUcphDEFl4jyHqZORK4Pd3 Db8oWqLmQ8lOCr/VOS7lrCtdpVMQkLGOGA16oJ8g7hzhnojpjY09UjsoUiG7oKac uxj8skfp6SIx93Zl+iNYPRa4S+za6nY8qiVjyUuiyX04ZPZMrKp2c2sGi+HnBKUZ XGhrz/Jdzdox3tjajWZnObyynhEN6hn9L3KawTtGPE/R6A/1RhHTD9FQmIWIeucp aY5c6GNKXTFpj2VYx57LY5hve1R5vhrJIZcgwZAiOtmik5lVi96glY5h6bugRwpe xjhwORTLPBCkwiYotSxX99mWd6EHL576i5CNABEBAAG0GUplZmYgTGF3IDxsYXdA cmVkaGF0LmNvbT6JAU4EEwEIADgWIQR+niGjtnP5P/8PpRq8fP682pgzWwUCWRsg 7wIbAwULCQgHAgYVCAkKCwIEFgIDAQIeAQIXgAAKCRC8fP682pgzW5QGB/9VATJm x5235RB+8jiDYGXQf3vd9gBfPy/l1tsaK400eFAevDzfGvKmeCKe+uGnlrH3vyT8 rg9zqH+s5a1Y+lDXPOpJAFmmzbOLU4FW4ucbawmtYvBL65PqpQneCTYnC802/OAc xjm/OnemHlgeK6WicNsBTPwYN/0araDFUejyYBIFi9CNqqflwk5Z3brKbQ9bAYIk ysVLC/c3njKPmM0cWPFHG91ubLbWCHwTIK0+mAL714eTD74dXzOjO2ZDBPLGlFN/ kO3+YjaO6UOD2O8acvAMCivTkWLr7JwRgLIQDN2DkhQDd3LTPqQE/yOcMcXBTO+f xm8KG0iKQBqWMyGJuQENBFkbIO8BCACyqbOsv7XegSeea8XORt5zMaBVWKoSyhmm cCmlxZFS2cuYOBt79MO13lZE2DlO3Lv5IKikj/D4ketGVO4+h5psEMH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