From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-oi1-x229.google.com (mail-oi1-x229.google.com [IPv6:2607:f8b0:4864:20::229]) by sourceware.org (Postfix) with ESMTPS id AE4B93858C5F for ; Fri, 4 Aug 2023 14:12:48 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org AE4B93858C5F Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-oi1-x229.google.com with SMTP id 5614622812f47-3a3b7f992e7so1595587b6e.2 for ; Fri, 04 Aug 2023 07:12:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1691158368; x=1691763168; h=content-transfer-encoding:in-reply-to:organization:from:references :to:content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=+nvNfhd+EaB9beigUvkZHJTG3clP3iJ/1pFybyG0DHQ=; b=vCjV1mEbCaTJHW8j5DwD1q56YY/bHKoAVWoQgJ2HGFsvTLKbIW4WnvuLuGbGQqQJmu 3WWbbdJbur8tJ2fEo+QYuTZ/TvxfkAJ8rzjkJkXnNEsJ56yW0gHmhEbEdNwFgC2k4UcX X02Sh6qB53iJG1syblQR23S28ME/g8KH+94QLVgXBjaTBwenc7/jDLN0RNDKgAqfYvUD L5I4ev7/lVyaSUS0CI5Bi80kGr7OCREHCL83N9p6Pm8K7TgiQ/rFf6TijCsfspi/y05D VUnf58MvFDEY+8S1be4txJTPqlkjyDXSW5Vr1Wp6yL0U/WEBw7cYHU75tMCOd+an8B2S 4x7w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691158368; x=1691763168; h=content-transfer-encoding:in-reply-to:organization:from:references :to:content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=+nvNfhd+EaB9beigUvkZHJTG3clP3iJ/1pFybyG0DHQ=; b=OZd/dsLd+yU/dOwk+K3VJVDS4L8A59+IHTreu6HHtUz+EbIZ/jEh9wQYEKWEYzPMXR a0ed1yOYmC1QcOtLsg8Yj5gtW3Yc4o2M77yw9tFDFFfxKBHcEiu2YH2HDSTNsZCkNHLA ogbo89Hml1B3F601LsTCBKKTIlZu2T4X7V3ZemjWKGKhUBJLyCsOtEbZ2fh4Ud1Kutlw PZPxjLQ5JnCP6ffpS7Q5324LpLGMfoK2HSFmV1sbCUQp1OB75Q/br3cGASAcFtnHURmA /YxAHCufrcTTGB1F3ruF4ksQNn8/lvRKPG1nP8aj5YGhjp7cH6ERCqtsiZeNMWT0y4Tp BRGg== X-Gm-Message-State: AOJu0YyVFsdQ0qTVbFpPQu0/1++opWgYlqiDI+cPnZJhvI3BpBBlwYkd ozMbS0CvAfZIevNFPHupQns7lw== X-Google-Smtp-Source: AGHT+IGoC3SXFJg+lmmVlxIvXXGImUbn15IqRaVWHla5FLJ90BJzlq5tLbGDSyqyPyrtuQpb10AiYg== X-Received: by 2002:a05:6808:159f:b0:3a7:a58:e818 with SMTP id t31-20020a056808159f00b003a70a58e818mr2287674oiw.33.1691158368025; Fri, 04 Aug 2023 07:12:48 -0700 (PDT) Received: from ?IPV6:2804:1b3:a7c1:9aa9:4d9b:c1fc:878b:d33a? ([2804:1b3:a7c1:9aa9:4d9b:c1fc:878b:d33a]) by smtp.gmail.com with ESMTPSA id d6-20020a05680813c600b003a37fd2be45sm1012208oiw.31.2023.08.04.07.12.46 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 04 Aug 2023 07:12:47 -0700 (PDT) Message-ID: <067bed0b-87f6-abbb-0e2a-14ee1a0ac0f9@linaro.org> Date: Fri, 4 Aug 2023 11:12:44 -0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.14.0 Subject: Re: posix_memalign performance regression in 2.38? Content-Language: en-US To: Xi Ruoyao , libc-alpha@sourceware.org, DJ Delorie References: <68e8c4eb66697f2f2cd37bf9456b60aabf7e1bc5.camel@xry111.site> From: Adhemerval Zanella Netto Organization: Linaro In-Reply-To: <68e8c4eb66697f2f2cd37bf9456b60aabf7e1bc5.camel@xry111.site> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-5.3 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On 03/08/23 23:52, Xi Ruoyao via Libc-alpha wrote: > Hi, > > There seems a performance regression of posix_memalign in Glibc-2.38: > > $ cat t.c > #include > int main() > { > void *buf; > for (int i = 0; i < (1 << 16); i++) > posix_memalign(&buf, 64, 16); > } > $ cc t.c > $ time ./a.out > > real 0m0.008s > user 0m0.005s > sys 0m0.003s > $ time ~/sources/lfs/glibc-2.38/build/testrun.sh ./a.out > > real 0m4.376s > user 0m4.369s > sys 0m0.007s > > The behavior seems worse than quadratic: if I change "1 << 16" to "1 << > 17", I get: > > $ time ~/sources/lfs/glibc-2.38/build/testrun.sh ./a.out > > real 0m28.597s > user 0m28.568s > sys 0m0.022s > > I've not bisected for this yet. > It seems to be caused by 24cdd6c71debfd10a9f7cb217fe2a2c4c486ed6f, where posix_memalign now calls chunk_ok_for_memalign (which takes most of time). DJ, any idea on how we can improve this?