Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3593033imu; Mon, 14 Jan 2019 05:51:28 -0800 (PST) X-Google-Smtp-Source: ALg8bN6MuNA6EpJgSVPtaGn5OjVuNcF65FSlhS574pP2fafKAbYPDed7kaL1GiFIdwux0YXjPFvJ X-Received: by 2002:a62:28c9:: with SMTP id o192mr25879176pfo.57.1547473888845; Mon, 14 Jan 2019 05:51:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547473888; cv=none; d=google.com; s=arc-20160816; b=TvvpYBcWUtlOGLye48U7ciQtFEzHOmdSkowhw25VxhTtzJck3e+hY+XuQeaq1PkUdJ rrGGXB5oXSiUYnN/5Eh3WedTdwos/7Gkt4rVUHZNGpWIsLEn0MquQ53DbbKhcUz9GkEo i0bY35TgGsK8cAGgRW3ppJLaW9WdCQ1acrt8NdYfow6owvN5OH0K2LX1eHQtspPjlxC5 w8qaS1HCvm+I1LyIyEvQ1NoBg9CCm0kE5FoUjCOv6Ddzkcv/B8Cg6QpKkcmphx6sHstR aiNmcPGYrirmJjLYuPpS9mDzb3GVCnT9GL3c4tfCoKy9EznY0fr5TrQZvfuyVTOosZFi CFNw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=KlHa+LpFHUiMKQScXoBgvTQj9wpZXHPiZDLKA4rMB4E=; b=MMAph/HItwdSX6MaekRwS8uCzPlrHpzIIBrj1Ni090L4ZxZ04hfr79qMby9a2ZPYeh 5qjb4IwMKiKEIOBCMoisgh2RII6mtj84z2kRiWkwO24MLvfdiOzvXAi3vaxXtKXvlkJx QwI2v3NWhHpAYqKDaiMKj4b85ZUCuYlNVeG9p1Mn8PmnIjm56jaukptzlK3vpU7/rvH6 02/0TPPm2KFU0CsDV5ceHkqR2mRc6npwgtakB+W0vueMw1k8xzKjtIMKMJIsZ4U0RHi3 BP78W+OoXWYx/TEHiVqELPTNxpJu6nDzPHmJNGhHQ0WyqmkSGlh781Uz/yg8xJPgn9cp 95Xw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@shutemov-name.20150623.gappssmtp.com header.s=20150623 header.b=mmApTXsz; 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 n28si385934pfb.88.2019.01.14.05.51.12; Mon, 14 Jan 2019 05:51:28 -0800 (PST) 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=@shutemov-name.20150623.gappssmtp.com header.s=20150623 header.b=mmApTXsz; 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 S1726595AbfANNuJ (ORCPT + 99 others); Mon, 14 Jan 2019 08:50:09 -0500 Received: from mail-pg1-f195.google.com ([209.85.215.195]:36075 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726482AbfANNuI (ORCPT ); Mon, 14 Jan 2019 08:50:08 -0500 Received: by mail-pg1-f195.google.com with SMTP id n2so9488194pgm.3 for ; Mon, 14 Jan 2019 05:50:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=shutemov-name.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=KlHa+LpFHUiMKQScXoBgvTQj9wpZXHPiZDLKA4rMB4E=; b=mmApTXsznp+lJR+QHVLxoSeraYzhdSWrd5jQAAYprSSRRxUkD1YvleaR8k2jp4DBsb WzyAch8e/K6xtSSg/nNYUdi+Ap1kDQkqpX2h45BSy+QsPW8oVpbf5+TdjL2ACUo6R6dv WaI56ek386bP+8ZyR0cAmLMmCoDetulKWfLC7+PxNIfTfSDQQQxGU6Fqq8fyZCD3Ga9J ojjjAVQ4KvvEc8ElPY+2k4/eIhptLOK4MYYqF2T4OznoejdUzdgZ+CZY+Skg9xbyzPm5 mFhuMdTmljckHotLtE2ejP1JUlGsxUvgXb5VyWYxhvkWddUQwubsfT0c0G+W//knJeq4 /znQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=KlHa+LpFHUiMKQScXoBgvTQj9wpZXHPiZDLKA4rMB4E=; b=mkgJXGslgRW8SC5EC/rleqKe/KUlWsYetA2sCo7hKRAIENCsmwOLWrkRrcZtLiLY3s S7wk0Npk3W5Rx+PNOKpjVMfgfo9OXUqQdkNdk460Koh59gGkpqzDNp891WyS2M37M8IB cIAwgWFvJHpnbt172/SrFBe8+e1OudJ0s78ifJJE4GLE2XC/hLqL0KJR6dBSJX2WItuo Vu2LyEVlY5OjtyDun47A/lQoIV9LAIBaoCAi7Ni37SshpCOJ6aSpIgxixzK2nrdZx5EC NJtsudVmQtUeQHzhAfOflyzpeMyt5RCCnGM5so6m7fuPVCwBXVhB83VMyNH5PSmKroKv gzzw== X-Gm-Message-State: AJcUukck9fyiODJ5fTsFwjGHqHXfru9XxW9qQ93vl1kdlWP3E2YnIzKT rmYBXrc1w4zF526ZfZfmwGDA4BkSPV6BYQ== X-Received: by 2002:a63:ef47:: with SMTP id c7mr12955696pgk.386.1547473807720; Mon, 14 Jan 2019 05:50:07 -0800 (PST) Received: from kshutemo-mobl1.localdomain ([134.134.139.82]) by smtp.gmail.com with ESMTPSA id n21sm956483pfg.84.2019.01.14.05.50.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 14 Jan 2019 05:50:06 -0800 (PST) Received: by kshutemo-mobl1.localdomain (Postfix, from userid 1000) id 4C71D300044; Mon, 14 Jan 2019 16:50:02 +0300 (+03) Date: Mon, 14 Jan 2019 16:50:02 +0300 From: "Kirill A. Shutemov" To: Mike Kravetz Cc: "Kirill A. Shutemov" , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Hugh Dickins , Michal Hocko , Dan Williams , Matthew Wilcox , Toshi Kani , Boaz Harrosh , Andrew Morton Subject: Re: [RFC PATCH] mm: align anon mmap for THP Message-ID: <20190114135001.w2wpql53zitellus@kshutemo-mobl1> References: <20190111201003.19755-1-mike.kravetz@oracle.com> <20190111215506.jmp2s5end2vlzhvb@black.fi.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: NeoMutt/20180716 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jan 11, 2019 at 03:28:37PM -0800, Mike Kravetz wrote: > Ok, I just wanted to ask the question. I've seen application code doing > the 'mmap sufficiently large area' then unmap to get desired alignment > trick. Was wondering if there was something we could do to help. Application may want to get aligned allocation for different reasons. It should be okay for userspace to ask for size + (alignment - PAGE_SIZE) and then round up the address to get the alignment. We basically do the same on kernel side. For THP, I believe, kernel already does The Right Thing™ for most users. User still may want to get speific range as THP (to avoid false sharing or something). But still I believe userspace has all required tools to get it right. -- Kirill A. Shutemov