From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pg1-x52b.google.com (mail-pg1-x52b.google.com [IPv6:2607:f8b0:4864:20::52b]) by sourceware.org (Postfix) with ESMTPS id E892F3858400 for ; Mon, 25 Oct 2021 16:03:41 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org E892F3858400 Received: by mail-pg1-x52b.google.com with SMTP id f5so11347707pgc.12 for ; Mon, 25 Oct 2021 09:03:41 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:subject:from:to:cc:references:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=wGi8tROSft7PZg3MAXhpMOSgwdyVszvmgTIEzjS6bJk=; b=ZlO8t5wyyoXC9JeQOxEG7Mk/Pcb++ZImjaKg75ZBeIOXgFQap5vv67yWmsmvQNTa3p oEW3e0eeFvBaE81xNiv+kj9Ru7T2O7KR6AAY6jIn9ddwn2Kjg0loNdAGYlUOp5Obnk60 P/Y0dd1MhGFSLdh5FP82RpLzemvRPFuyuvbwFr4mMWLj5Z4kcqrU0Eh0Me3GXE3k0bAq 099YSOJAMV1PtG8HKRDHkf/jlspNY7j8VAMNSXbPvYsK/3rI2G7jO3oXYFAUZwXFarAv rdBGsuCYgmPQ+PcuIjoyRncVrF6NS6qWZ7QBNL72BFN8OiMhlVWWubZS9kZnyXbUzppg Ax7A== X-Gm-Message-State: AOAM532PDfumfYaLX8vbOzcAIxmW1Yd6iaN4/1wnqUnBLbCxvQ1e1xnZ 8pWp7RoZMwH1y//44Tm1Gq0= X-Google-Smtp-Source: ABdhPJwv0vI71Y40IL5Ue8xJIODtsbC5hBgHbWHIklH7SDOyqab2xtidhTCw4oE8l/Cn+Ywrtqr4pg== X-Received: by 2002:aa7:8b1a:0:b0:44d:37c7:dbb6 with SMTP id f26-20020aa78b1a000000b0044d37c7dbb6mr19917276pfd.11.1635177820856; Mon, 25 Oct 2021 09:03:40 -0700 (PDT) Received: from [192.168.0.41] (184-96-250-116.hlrn.qwest.net. [184.96.250.116]) by smtp.gmail.com with ESMTPSA id t22sm147708pfg.63.2021.10.25.09.03.38 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 25 Oct 2021 09:03:40 -0700 (PDT) Subject: Re: [PATCH] manual: remove an obsolete requirement on aligned_alloc() usage From: Martin Sebor To: John Scott , libc-alpha@sourceware.org References: <33ec9e0c1e587813b90e8aa771c2c8e6e379dd48.camel@posteo.net> <11bc87c2-d59c-0e32-79a4-68bf7d01a2b8@gmail.com> Message-ID: Date: Mon, 25 Oct 2021 10:03:35 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.2.2 MIME-Version: 1.0 In-Reply-To: <11bc87c2-d59c-0e32-79a4-68bf7d01a2b8@gmail.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-11.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Oct 2021 16:03:43 -0000 On 10/25/21 9:45 AM, Martin Sebor wrote: > On 10/21/21 3:28 AM, John Scott via Libc-alpha wrote: >> I'm not subscribed; please CC me. >> > > Carlos asked me offline to comment on this change.  I'm not > a Glibc expert so I'll do my best but I defer to others here > who know the allocator much better. > > diff --git a/manual/memory.texi b/manual/memory.texi > index 0b2b9c87..5c16f7ae 100644 > --- a/manual/memory.texi > +++ b/manual/memory.texi > @@ -995,7 +995,7 @@ power of two than that, use @code{aligned_alloc} or > @code{posix_memalign}. >  @c Alias to memalign. >  The @code{aligned_alloc} function allocates a block of @var{size} > bytes whose >  address is a multiple of @var{alignment}.  The @var{alignment} must be a > -power of two and @var{size} must be a multiple of @var{alignment}. > +power of two. > > Based on my code inspection of _mid_memalign in malloc.c I think > a change that would more accurately reflect the implementation > is one that described that when alignment is not a power of two > it's bumped up to next larger power of two, and adjusted > the EINVAL condition appropriately.  Attached is a diff along > these lines.  Please feel free to use it as you see fit. Also, to answer the follow-up question in Patchwork (I can't find it in my mailbox): Was that fixed in C17? Or in (yet unreleased) C2X? I believe the DR460 change went into C17. Here's an early C2x draft from 2018 publicly available on the WG14 site that should still be very close to C17: http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2310.pdf > > Martin