This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
RE: [RFC PATCH]: Align large allocations to cacheline
- From: "Wilco Dijkstra" <wdijkstr at arm dot com>
- To: "'Will Newton'" <will dot newton at linaro dot org>, "Ramana Radhakrishnan" <Ramana dot Radhakrishnan at arm dot com>
- Cc: "libc-alpha" <libc-alpha at sourceware dot org>
- Date: Wed, 29 Oct 2014 14:39:41 -0000
- Subject: RE: [RFC PATCH]: Align large allocations to cacheline
- Authentication-results: sourceware.org; auth=none
- References: <002301cff37e$61c12330$25436990$ at com> <CANu=DmjyEFCJ=_qxmdYm9Guh_miGeWp0m1HS3rkzai=N-zimUQ at mail dot gmail dot com> <CAJA7tRbvYAYUJC8GLZphfPpsE3AD5xB6tQG141NBOBRa0xD7GA at mail dot gmail dot com> <CANu=DmgwzhzdRmJpNGPOMOH4burhA=dQGntm75=faNHyYR3C=A at mail dot gmail dot com>
> Will Newton wrote:
> >> This will change the behaviour of malloc hooks i.e. the malloc hook
> >> will not get triggered but memalign will.
> >
> > Yeah that was my first reaction too - but read _mid_memalign - that
> > appears to call the malloc hooks too ?
>
> But _mid_memalign calls the memalign hook rather than the malloc hook
> which is rather surprising given we called malloc. It should simply be
> a case of moving the #ifdef block to below the call of the malloc hook
> in __libc_malloc to retain the existing behaviour.
Right, it would be trivial to move the code so that the malloc hook
is tried first. However if it isn't set then it will try the memalign
hook as well. I'm unclear what the idea of the hooks is, to hook the
original call only or to hook whatever low-level function you eventually
fall into or any combination... There is also an overhead in trying
several hooks rather than just one.
One possibility would be to split _mid_memalign, skip all the
unnecessary tests on alignment (which we know is correct) and directly go
to the arena_get part, which is simpler and faster.
Wilco