Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp54806img; Tue, 19 Mar 2019 17:44:05 -0700 (PDT) X-Google-Smtp-Source: APXvYqxekhcnP+JzEAmGqyhiKwjP3fWa2kCmAdY1NYx5283NAHW+7tlXRn6QFcNxPwOq7tYPzw6U X-Received: by 2002:a17:902:a9c8:: with SMTP id b8mr4972249plr.12.1553042645373; Tue, 19 Mar 2019 17:44:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553042645; cv=none; d=google.com; s=arc-20160816; b=xuis19U2moyFkSXhvLiI7OQ8WJvp8mWZFbKX6I1jdBwafyYEAlT3lLLAvaRtR7OqJ1 eLObE4JcjFIGNl19uSz2d0z76cLydTcfgFW2D+A06BjzP3mLVZ04uASCSworvCtDSC9+ lfufnU/TiRKN6peXH0jzOPOlWWmb/4hM9oiB7Wp7p5MvQHflai+1+sIMw7pGgVs5mVuA GDV1kYxWF0ensbcHcjY+FH0JXbD5Jc4SBLbej/j64U0CVtovCrxfzJzYHfLHHXcXHmJ7 OdpVv2TAGo2bC9M+OPB2oJW8brhJZ+jzWdtPXSq4f4/wDQkTphtIEQ2EboYLkg6eyudp VgpA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:feedback-id:mime-version:user-agent :references:message-id:in-reply-to:subject:cc:to:from:date :dkim-signature; bh=B9sioxXwJ8rVpdbilI7Fnpz1yz5RdR7tc4Xt5PO+emc=; b=XWQSmbIC+FrekfZ+zIHGWBRzSNE4p+doh6Ueumwb+DJK5wfF8+h0YX25hnWxQTR/i0 bedKTGqNJrlkSZRu89XkxPQ17VlRwICAnBQadKi7cDCi5Jf59qKCBPJ6+lbEXCIhaAHK 7DWSNpy30GQMIWtWmX5b5a4mKeVV8JwcLIU6M37Rb9NJNjTYblrLYAPwmPfYy+7r+g33 +qDTebLo+BHhNBC7xNYwfd014z1qiB56cw6IbKQSziRzxvipdJbqD3Tpgq9D/+5TdK2t rsGwr2fCnvkcZAf7Bov1OPUQ9BcHO1CDbPxpk5qsxv/dazJv8HDnk7Ndyto+PNC3Lv5d qKnA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amazonses.com header.s=6gbrjpgwjskckoa6a5zn6fwqkn67xbtw header.b=VBwKJkug; 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 13si316351pgm.311.2019.03.19.17.43.49; Tue, 19 Mar 2019 17:44:05 -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; dkim=pass header.i=@amazonses.com header.s=6gbrjpgwjskckoa6a5zn6fwqkn67xbtw header.b=VBwKJkug; 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 S1727154AbfCTAnM (ORCPT + 99 others); Tue, 19 Mar 2019 20:43:12 -0400 Received: from a9-112.smtp-out.amazonses.com ([54.240.9.112]:37312 "EHLO a9-112.smtp-out.amazonses.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725958AbfCTAnM (ORCPT ); Tue, 19 Mar 2019 20:43:12 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=6gbrjpgwjskckoa6a5zn6fwqkn67xbtw; d=amazonses.com; t=1553042591; h=Date:From:To:cc:Subject:In-Reply-To:Message-ID:References:MIME-Version:Content-Type:Feedback-ID; bh=B9sioxXwJ8rVpdbilI7Fnpz1yz5RdR7tc4Xt5PO+emc=; b=VBwKJkug3HTMEURo5qyOD/z9okFI4YVhcpxmD0DrF5468WQ+ew8H9nnZbSc3g7aC 73YNYCesh3CpjPthWstPYZD59v0KRTJ8bhUvP+WmW+teVrsGiQTJDhYOAccKtv58/WN ama1QEg4t9G6OAHEP7NJs8i+YtezrZ212eZIzZ8g= Date: Wed, 20 Mar 2019 00:43:11 +0000 From: Christopher Lameter X-X-Sender: cl@nuc-kabylake To: Vlastimil Babka cc: linux-mm@kvack.org, 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 Subject: Re: [RFC 0/2] guarantee natural alignment for kmalloc() In-Reply-To: <20190319211108.15495-1-vbabka@suse.cz> Message-ID: <01000169988d4e34-b4178f68-c390-472b-b62f-a57a4f459a76-000000@email.amazonses.com> References: <20190319211108.15495-1-vbabka@suse.cz> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-SES-Outgoing: 2019.03.20-54.240.9.112 Feedback-ID: 1.us-east-1.fQZZZ0Xtj2+TD7V5apTT/NrT6QKuPgzCT/IC7XYgDKI=:AmazonSES Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 19 Mar 2019, Vlastimil Babka wrote: > 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. This means that the alignments are no longer uniform for all kmalloc caches and we get back to code making all sorts of assumptions about kmalloc alignments. Currently all kmalloc objects are aligned to KMALLOC_MIN_ALIGN. That will no longer be the case and alignments will become inconsistent. I think its valuable that alignment requirements need to be explicitly requested. Lets add an array of power of two aligned kmalloc caches if that is really necessary. Add some GFP_XXX flag to kmalloc to make it ^2 aligned maybe?