Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp6999img; Tue, 19 Mar 2019 14:12:57 -0700 (PDT) X-Google-Smtp-Source: APXvYqwUyDshSXG2ScaPu0KUBeUtJlXvLipzn2Y69p5Y3r7ROVMQse7Xg6LvuJ1bWcTC6z1rL6rX X-Received: by 2002:a17:902:f209:: with SMTP id gn9mr4146232plb.50.1553029977181; Tue, 19 Mar 2019 14:12:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553029977; cv=none; d=google.com; s=arc-20160816; b=p+Los2PBnswAkINGqpS/dD70X4uu80FFao7Wnr++eHMOIDv99UOARxCUWQhvNpxVzi j6KMj43epSp/a4TZBSKAACvlv+sX9YjMgHQy6yGnug9TMRE2vGYKfgeWy8vsFJEcO7Z8 j4JZk3FWdmqwc3/adqOC4MYiOS6VJ2MGDXcuf39nwoklUyPVCS3z5N5P9ygq7YD6nLZV q6xww9IaL6/f921vW5CixqNpRO5g+1BnhYI1PeXxJVYcei/3RhUCcMhGTGNH/w7nB2kV VKIexEpq5lD8uZzYF5/IsomL6bFurgDv+oalwqLgTOfA8ccHMAZz8vhoymTxJROz8P41 Qogw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=YReB/SZd25tJDVYEi7c1Vao07+DoqlvR0siXPnd81b0=; b=W7SaYWJuMgBB9vfwv7kFRjPao1ezlrxNKJM5sT3QMuQ5uGdlYfCk6ka555U+RQoei+ l0fACG7U67CdW4KjsXIsIaDaHC63z4eGgV+/yd5JwsYqWaJcz6/2011P5PbeYDRPUFiV UhDBuCRqf8bY00TgQFipRQT3Eymj0sq4FXZyDgZ/IzvoG6PleUStqfHSQtu8jgFU6uE6 KsI+l9//y24uPgjdZJ010AoJdBpBwCTBoMrLQ1W61Y7a7vHQaudAxBlFnjlLmIGcUhWK SlLn+COgiqd76IRo8uN8gjszml0C/IbcMZ7tzOJGrOe287C7SSgXjb4BMOVbPKl8dqbr oD2Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p2si9168224pfd.257.2019.03.19.14.12.38; Tue, 19 Mar 2019 14:12:57 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727604AbfCSVLa (ORCPT + 99 others); Tue, 19 Mar 2019 17:11:30 -0400 Received: from mx2.suse.de ([195.135.220.15]:41338 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726627AbfCSVL3 (ORCPT ); Tue, 19 Mar 2019 17:11:29 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 96729B607; Tue, 19 Mar 2019 21:11:27 +0000 (UTC) From: Vlastimil Babka To: linux-mm@kvack.org Cc: Christoph Lameter , Pekka Enberg , David Rientjes , Joonsoo Kim , Ming Lei , Dave Chinner , Matthew Wilcox , "Darrick J . Wong" , Christoph Hellwig , Michal Hocko , linux-kernel@vger.kernel.org, linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-block@vger.kernel.org, Vlastimil Babka Subject: [RFC 0/2] guarantee natural alignment for kmalloc() Date: Tue, 19 Mar 2019 22:11:06 +0100 Message-Id: <20190319211108.15495-1-vbabka@suse.cz> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The recent thread [1] inspired me to look into guaranteeing alignment for kmalloc() for power-of-two sizes. Turns out it's not difficult and in most configuration nothing really changes as it happens implicitly. More details in the first patch. If we agree we want to do this, I will see where to update documentation and perhaps if there are any workarounds in the tree that can be converted to plain kmalloc() afterwards. The second patch is quick and dirty selftest for the alignment. Suggestions welcome whether and how to include this kind of selftest that has to be in-kernel. [1] https://lore.kernel.org/linux-fsdevel/20190225040904.5557-1-ming.lei@redhat.com/T/#u Vlastimil Babka (2): mm, sl[aou]b: guarantee natural alignment for kmalloc(power-of-two) mm, sl[aou]b: test whether kmalloc() alignment works as expected mm/slab_common.c | 30 +++++++++++++++++++++++++++++- mm/slob.c | 42 +++++++++++++++++++++++++++++++----------- 2 files changed, 60 insertions(+), 12 deletions(-) -- 2.21.0