public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Stefan Liebler <stli@linux.ibm.com>
To: Florian Weimer <fweimer@redhat.com>
Cc: libc-alpha@sourceware.org
Subject: Re: [PATCH v3] malloc: Remove bin scanning from memalign (bug 30723)
Date: Wed, 20 Sep 2023 16:35:47 +0200	[thread overview]
Message-ID: <86399d3a-c453-1805-0d6b-62fa6e025108@linux.ibm.com> (raw)
In-Reply-To: <87r0muf4lw.fsf@oldenburg.str.redhat.com>

On 19.09.23 19:35, Florian Weimer wrote:
> * Stefan Liebler:
> 
>> On 11.08.23 17:48, Florian Weimer via Libc-alpha wrote:
>>> On the test workload (mpv --cache=yes with VP9 video decoding), the
>>> bin scanning has a very poor success rate (less than 2%).  The tcache
>>> scanning has about 50% success rate, so keep that.
>>>
>>> Update comments in malloc/tst-memalign-2 to indicate the purpose
>>> of the tests.  Even with the scanning removed, the additional
>>> merging opportunities since commit 542b1105852568c3ebc712225ae78b
>>> ("malloc: Enable merging of remainders in memalign (bug 30723)")
>>> are sufficient to pass the existing large bins test.
>> Hi,
>>
>> on s390x, I've observed these test-fails starting with this commit:
>> FAIL: malloc/tst-memalign-2
>> FAIL: malloc/tst-memalign-2-malloc-hugetlb1
>>
>> With this output:
>> error: tst-memalign-2.c:158: not true: count > LN / 2
>> error: 1 test failures
>>
>> Note, that I only see the fails if /proc/sys/kernel/randomize_va_space
>> is set to 0. Then I get count=3; LN=8;
>>
>> If randomize_va_space is set to 2, the test passes and I get count=5; LN=8;
>>
>> Is s390x the only architecture where we get this failure?
> 
> Does your kernel have a fix for the early sbrk failure?  I suspect what
> happens is that we fall over to mmap from sbrk, making the heap
> non-contiguous.
> 
> The sbrk failure should be visible under strace.
> 
Yes, strace shows mmap with randomize_va_space=0:
brk(NULL)                               = 0x3fff7fb2000
brk(0x3fff7fd3000)                      = 0x3fff7fd3000
brk(0x3fff7ff7000)                      = 0x3fff7fd3000
mmap(NULL, 1048576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1,
0) = 0x3fff7b00000
write(1, "error: tst-memalign-2.c:158: not"..., 54error:
tst-memalign-2.c:158: not true: count > LN / 2
) = 54

Note that there is this previous mmap-event before set_tid_address-syscall:
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0)
= 0x3fff7ff7000

With with randomize_va_space=2, I see:
brk(NULL)                               = 0x2aa005e8000
brk(0x2aa00609000)                      = 0x2aa00609000
brk(0x2aa0062d000)                      = 0x2aa0062d000
brk(0x2aa00654000)                      = 0x2aa00654000
exit_group(0)                           = ?


I think you mean the kernel fixes as documented in the static PIE
confiugre-check:
https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/s390/s390-64/configure.ac;h=4657de0d3795f40388805d438178c63f9558e936;hb=HEAD#l85
Those commits went into linux 5.19 and I see the fails on kernels with 6.xyz



> Thanks,
> Florian
> 


  reply	other threads:[~2023-09-20 15:01 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-11 15:48 Florian Weimer
2023-09-19 14:32 ` Stefan Liebler
2023-09-19 17:35   ` Florian Weimer
2023-09-20 14:35     ` Stefan Liebler [this message]
2023-09-20 15:31       ` Florian Weimer
2023-09-21 13:05         ` Stefan Liebler

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=86399d3a-c453-1805-0d6b-62fa6e025108@linux.ibm.com \
    --to=stli@linux.ibm.com \
    --cc=fweimer@redhat.com \
    --cc=libc-alpha@sourceware.org \
    /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).