From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.3 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B8595C388F3 for ; Tue, 1 Oct 2019 11:32:19 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 6B9EB21A4A for ; Tue, 1 Oct 2019 11:32:19 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=shutemov-name.20150623.gappssmtp.com header.i=@shutemov-name.20150623.gappssmtp.com header.b="QfS4Zl1/" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6B9EB21A4A Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=shutemov.name Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id F30448E0005; Tue, 1 Oct 2019 07:32:18 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id EE0E58E0001; Tue, 1 Oct 2019 07:32:18 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E1F848E0005; Tue, 1 Oct 2019 07:32:18 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0087.hostedemail.com [216.40.44.87]) by kanga.kvack.org (Postfix) with ESMTP id C1BE38E0001 for ; Tue, 1 Oct 2019 07:32:18 -0400 (EDT) Received: from smtpin03.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with SMTP id 59442181AC9B4 for ; Tue, 1 Oct 2019 11:32:18 +0000 (UTC) X-FDA: 75995002356.03.nest54_4e43cb4b42b1f X-HE-Tag: nest54_4e43cb4b42b1f X-Filterd-Recvd-Size: 5023 Received: from mail-ed1-f68.google.com (mail-ed1-f68.google.com [209.85.208.68]) by imf31.hostedemail.com (Postfix) with ESMTP for ; Tue, 1 Oct 2019 11:32:17 +0000 (UTC) Received: by mail-ed1-f68.google.com with SMTP id a15so11565278edt.6 for ; Tue, 01 Oct 2019 04:32:17 -0700 (PDT) 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:in-reply-to:user-agent; bh=lCGrxhcB/+iEshHFfidiQ7x9s/rMo7Q8hflUr8m+6po=; b=QfS4Zl1/GsIweSpHy1jVGdzJo/9HTx+ebgDpkvOyF+x3JNID3/YW722nrsLK0GRPMM bgyuVyo3Y5oKUWYcRCSFnlfRSo/RNjrlHNmYJalwEyVUd5xC73XZHT8C/6/KaXOZ5QIE ELEhYTJvYWi8+QZiRVTTXnOZFDC/kepWgWk1dqRYj48F2zmTPgmoD7Ee7oKQJSLcwaCQ 0QqXuA9kJecUYaqKwt/zoXCbDpPT647LyZ4cGMDZcRx7CfFMZIxrabbTJXm7L7ZUZzay LmCdcUOt1LdqUIYN4nRDwQccsSbw5bEXPo4YaIJhHHhWNdifcuXEtE2esqFaBMyxtI3D aKVA== 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:in-reply-to:user-agent; bh=lCGrxhcB/+iEshHFfidiQ7x9s/rMo7Q8hflUr8m+6po=; b=C4IZS4iM8CsKIUqlb/H4htljXK3Tx4VdrLQQPSYK3WXAIZC97CE5H0db7Dw508FSBJ Bhm5qiZ+IDaWlwZP47CsNNWYGMhMvHqUcuTZV0qkRNxej2T4bWo7uMFebqWtQWYn0P3e Tzq3aTdjsvPo+CzBQmIo9x63tGcLoiUJeJtLLMT/rPYOxpgasVYoLlO2XZdxw3lwtHz6 6905cDQCt0uWSxgaW2Ti7yj5p255htHDhpiUf7vd4ZIzEjfdKGspnu8D5AfZKYpIqWzk At6ScFssg54xrzLlqOQrD/hybOBekEXwuW8IPM/NAocRIyXPGyOQxgCQbG/zLiQ+G6UX lmog== X-Gm-Message-State: APjAAAX3oCJ5soSaHfHo0/U4sA+Sa8UllCf/EPf2IQn95fO/XXSAOJQt MMdv5uNZf5R69/hR1SWUZyFUXQ== X-Google-Smtp-Source: APXvYqxUu7r9KkLSUQ4qzyBtyXTZoSMDeyCZcpbwZlxw26HMZjQAZjkMxKkrWlcyrlww3lQL7ZOGzg== X-Received: by 2002:a50:f0d4:: with SMTP id a20mr25567858edm.149.1569929536456; Tue, 01 Oct 2019 04:32:16 -0700 (PDT) Received: from box.localdomain ([86.57.175.117]) by smtp.gmail.com with ESMTPSA id w16sm3089185edd.93.2019.10.01.04.32.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 01 Oct 2019 04:32:15 -0700 (PDT) Received: by box.localdomain (Postfix, from userid 1000) id 33253102FB8; Tue, 1 Oct 2019 14:32:16 +0300 (+03) Date: Tue, 1 Oct 2019 14:32:16 +0300 From: "Kirill A. Shutemov" To: William Kucharski Cc: Matthew Wilcox , linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 14/15] mm: Align THP mappings for non-DAX Message-ID: <20191001113216.3qbrkqmb2b2xtwkd@box> References: <20190925005214.27240-1-willy@infradead.org> <20190925005214.27240-15-willy@infradead.org> <20191001104558.rdcqhjdz7frfuhca@box> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20180716 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Tue, Oct 01, 2019 at 05:21:26AM -0600, William Kucharski wrote: > > > > On Oct 1, 2019, at 4:45 AM, Kirill A. Shutemov wrote: > > > > On Tue, Sep 24, 2019 at 05:52:13PM -0700, Matthew Wilcox wrote: > >> > >> diff --git a/mm/huge_memory.c b/mm/huge_memory.c > >> index cbe7d0619439..670a1780bd2f 100644 > >> --- a/mm/huge_memory.c > >> +++ b/mm/huge_memory.c > >> @@ -563,8 +563,6 @@ unsigned long thp_get_unmapped_area(struct file *filp, unsigned long addr, > >> > >> if (addr) > >> goto out; > >> - if (!IS_DAX(filp->f_mapping->host) || !IS_ENABLED(CONFIG_FS_DAX_PMD)) > >> - goto out; > >> > >> addr = __thp_get_unmapped_area(filp, len, off, flags, PMD_SIZE); > >> if (addr) > > > > I think you reducing ASLR without any real indication that THP is relevant > > for the VMA. We need to know if any huge page allocation will be > > *attempted* for the VMA or the file. > > Without a properly aligned address the code will never even attempt allocating > a THP. > > I don't think rounding an address to one that would be properly aligned to map > to a THP if possible is all that detrimental to ASLR and without the ability to > pick an aligned address it's rather unlikely anyone would ever map anything to > a THP unless they explicitly designate an address with MAP_FIXED. > > If you do object to the slight reduction of the ASLR address space, what > alternative would you prefer to see? We need to know by the time if THP is allowed for this file/VMA/process/whatever. Meaning that we do not give up ASLR entropy for nothing. For instance, if THP is disabled globally, there is no reason to align the VMA to the THP requirements. -- Kirill A. Shutemov