public inbox for fortran@gcc.gnu.org
 help / color / mirror / Atom feed
From: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
To: Lipeng Zhu <lipeng.zhu@intel.com>,
	Lipeng Zhu via Fortran <fortran@gcc.gnu.org>,
	tkoenig@netcologne.de,  gcc-patches@gcc.gnu.org
Cc: hongjiu.lu@intel.com, tianyou.li@intel.com, pan.deng@intel.com,
	 wangyang.guo@intel.com
Subject: Re: [PATCH v3] libgfortran: Replace mutex with rwlock
Date: Wed, 19 Apr 2023 16:50:18 +0200	[thread overview]
Message-ID: <CAC1BbcS1TpN_Rq4PCnJRCLBNDiJbFN2Jxd60HpHA06y5fNDpSg@mail.gmail.com> (raw)
In-Reply-To: <03CB84EE-5550-4F48-A591-1A02B998CA95@gmail.com>

On Wed, 19 Apr 2023 at 14:51, Bernhard Reutner-Fischer
<rep.dot.nop@gmail.com> wrote:
>
> On 19 April 2023 09:06:28 CEST, Lipeng Zhu via Fortran <fortran@gcc.gnu.org> wrote:
>
> >+#ifdef __GTHREAD_RWLOCK_INIT
> >+#define RWLOCK_DEBUG_ADD(rwlock) do {         \
> >+    aio_rwlock_debug *n;                              \
> >+    n = malloc (sizeof(aio_rwlock_debug));    \
>
> My malloc can fail.

Sorry, i hit send too early.
Please use xmalloc as defined in libgfortran/runtime/memory.c

PS: IIRC we have likely() / unlikely() macros in libgfortran, so you
may want to check if you want to annotate some conditions accordingly
if predict gets it wrong.
thanks,
>
> >+    n->prev = TAIL_RWLOCK_DEBUG_QUEUE;                        \
> >+    if (n->prev)                              \
> >+      n->prev->next = n;                      \
> >+    n->next = NULL;                           \
> >+    n->line = __LINE__;                               \
> >+    n->func = __FUNCTION__;                   \
> >+    n->rw = rwlock;                           \
> >+    if (!aio_rwlock_debug_head) {                     \
> >+      aio_rwlock_debug_head = n;                      \
> >+    }                                         \
> >+  } while (0)
> >+
>

  reply	other threads:[~2023-04-19 14:50 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20221230001607.2232962-1-lipeng.zhu () intel ! com>
2023-04-19  7:06 ` Lipeng Zhu
2023-04-19 12:51   ` Bernhard Reutner-Fischer
2023-04-19 14:50     ` Bernhard Reutner-Fischer [this message]
2023-04-19 21:49   ` Bernhard Reutner-Fischer
2023-04-20 13:13 Zhu, Lipeng
2023-04-24 19:45 ` Bernhard Reutner-Fischer
2023-05-08  9:31 Zhu, Lipeng
2023-05-08 10:04 ` Bernhard Reutner-Fischer

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=CAC1BbcS1TpN_Rq4PCnJRCLBNDiJbFN2Jxd60HpHA06y5fNDpSg@mail.gmail.com \
    --to=rep.dot.nop@gmail.com \
    --cc=fortran@gcc.gnu.org \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=hongjiu.lu@intel.com \
    --cc=lipeng.zhu@intel.com \
    --cc=pan.deng@intel.com \
    --cc=tianyou.li@intel.com \
    --cc=tkoenig@netcologne.de \
    --cc=wangyang.guo@intel.com \
    /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).