Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp4241874rwb; Fri, 30 Sep 2022 15:24:47 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7vNm2mo5eUy7MyCD7vlNnEQWK8rapWL2nDA2CPgHvISsb/SB2mYyBc8SSTvjEX/gvD6DMT X-Received: by 2002:a05:6402:34cb:b0:451:61c9:a316 with SMTP id w11-20020a05640234cb00b0045161c9a316mr9851421edc.268.1664576687692; Fri, 30 Sep 2022 15:24:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664576687; cv=none; d=google.com; s=arc-20160816; b=ztPDzuFbv87uRCyBB3pkapfbX7f2jZangb+AvqHoIjofRcxuPeasOPlDPDMzXqvtou HHdsyYMoCDHkSG0XK3kMUMSJnKCDdhPKDMe4DOGBeC2Qtbdl7YfYXCTu78xmTEkDEh5u nOl03gtRM1HMeJdbw467npuG54Xj2bHou73G53NB1iRArhpDNiJuxPS+GkXQH3mdQfwN rOAte4sS/kYHtkWN8QhxRL1tUaRNezjP2eaXIW9+uBHNNGPAnVNG/8oIFdPXRv/SZPM0 ioxQxG/4SgwcCAW25hW9I+Rk0oE+8MyBRM1nce3vnzdqSkQk5yijP00mPXkIjF6VdobO lcPQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :mime-version:accept-language:in-reply-to:references:message-id:date :thread-index:thread-topic:subject:cc:to:from; bh=V/y86XNhA1Lfg6IGEVWmUg/4jAnJm49eHZdrsvjbZ3A=; b=N+ipeSlWJy3YDg8+F1cSGmx68PheoZl+CjaIeADh20PNYrFo7kazRKygS7FSoaB0+k NTYjHZMfgWz/UkGUcl1PAktkBjQtsQmAKRzFQYuf9YTflUym4oRm6krDjfyHA5vrwFJq OL/F7xXfMORUR9FnhvucliK39+Z15AHdztBnrrvKnccoJz63Z8PMPYY0Keisdh/M58oW qDaK3IcD4+fuPZcUHJZr1b1qsGRpMVCsO4Tf/5BGGw0lNgiWRI1s+6HkzPoGXvkUPnor 3xXqSN8Mc66EcI6bybq2sKoZbZ9VfVGIiH8pBuHqp44Qd19s/4GJDe2bwvw/OEUZkGYR /buw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=aculab.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b5-20020a056402084500b004483a12fba9si3366185edz.210.2022.09.30.15.23.58; Fri, 30 Sep 2022 15:24:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=aculab.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231864AbiI3Vep convert rfc822-to-8bit (ORCPT + 99 others); Fri, 30 Sep 2022 17:34:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56852 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231654AbiI3Ve1 (ORCPT ); Fri, 30 Sep 2022 17:34:27 -0400 Received: from eu-smtp-delivery-151.mimecast.com (eu-smtp-delivery-151.mimecast.com [185.58.85.151]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B339B1D1A7A for ; Fri, 30 Sep 2022 14:34:26 -0700 (PDT) Received: from AcuMS.aculab.com (156.67.243.121 [156.67.243.121]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id uk-mta-92-6L0_Y9URMfO4eHTHzlMxwg-1; Fri, 30 Sep 2022 22:34:24 +0100 X-MC-Unique: 6L0_Y9URMfO4eHTHzlMxwg-1 Received: from AcuMS.Aculab.com (10.202.163.4) by AcuMS.aculab.com (10.202.163.4) with Microsoft SMTP Server (TLS) id 15.0.1497.38; Fri, 30 Sep 2022 22:34:23 +0100 Received: from AcuMS.Aculab.com ([::1]) by AcuMS.aculab.com ([::1]) with mapi id 15.00.1497.040; Fri, 30 Sep 2022 22:34:23 +0100 From: David Laight To: 'Hugh Dickins' , Kees Cook CC: Vlastimil Babka , Joel Fernandes , Hyeonggon Yoo <42.hyeyoo@gmail.com>, Matthew Wilcox , Andrew Morton , "linux-kernel@vger.kernel.org" , "linux-mm@kvack.org" Subject: RE: amusing SLUB compaction bug when CC_OPTIMIZE_FOR_SIZE Thread-Topic: amusing SLUB compaction bug when CC_OPTIMIZE_FOR_SIZE Thread-Index: AQHY1LmyNvo5HN+EEECxPXiP8YKQXa33zoaAgABIuACAAGaCkA== Date: Fri, 30 Sep 2022 21:34:23 +0000 Message-ID: References: <35502bdd-1a78-dea1-6ac3-6ff1bcc073fa@suse.cz> <16fe443a-dabe-aa46-6bc7-dad03f29e0dc@google.com> <06329f-e498-ccc-6223-32f87716436d@google.com> In-Reply-To: <06329f-e498-ccc-6223-32f87716436d@google.com> Accept-Language: en-GB, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.202.205.107] MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: aculab.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Hugh Dickins > Sent: 30 September 2022 17:22 > > On Fri, 30 Sep 2022, David Laight wrote: > > > > > Regarding "conflicting" alignment requests: yes, I agree with you, > > > > > it would have to be a toolchain bug if when asked to align 2 and to > > > > > align 4, it chose not to align 4. > > > > See https://godbolt.org/z/3nGsTaf5e > > the align() directive takes precedence. > > > > Here you only want to ensure the alignment is at least 4. > > Sorry, I don't understand the point you are making, > nor how to deduce it from the link which you give: > I'll leave it to those who understand better. (I've copied Kees Cook - I think it is his patches that are increasing the function alignment. He'll need to find the thread history...) IIRC -malign_functions is being used to put functions onto 16 byte boundaries to get aligned pad space before the function. Adding __align(4) overrides this and (I think) will remove the pad space. I could only see the alignment directives in gcc ouput. clang didn't seem to generate them. David - Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)