Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp675406img; Fri, 22 Mar 2019 06:22:28 -0700 (PDT) X-Google-Smtp-Source: APXvYqwNH/qPSB+187tsGM3xifHatKLNZtIOY6c27GX+10h94XAeCuVJ8PluQXhJ433IlJAQLUCX X-Received: by 2002:a63:3244:: with SMTP id y65mr8853913pgy.417.1553260947896; Fri, 22 Mar 2019 06:22:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553260947; cv=none; d=google.com; s=arc-20160816; b=fTDhW++zjdVMBjD8fxc5Eo0PmohulI56j5Cce517u3MBOqwRzq9NqdVghR0GxpGBRm o6xWN8Uz+Q3uEtw6TQmrl00xLJIU9jwTp6gqKdte4aSyIaL5aWDcZivrdbxrK/el4zGE Jw0uXL3qGwI3g3SPlO4PqUOKH4qTUf5/Z0uHglpKbFKABc+e82FbAatiqNqBWIHTRHI3 i8DZ0d9CbyIZnpkCNf8sVxlBstTIJhNbSlFmQgofMtmmSl2BIbafS22LDCX4DsfYeUTC h2umIK9lXRTGRzAd8irRjrw1Scdky8gH6vcG3OG0DSHgJJEEl8/G8940vDVojUkq6jfk q38g== 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=hw3ZtZSh4y78LcwFC7knlBZdOdzIfUNtqXkI2P++IvI=; b=gffCYBq7CMMN0HDmEnhl+Y8ybYf2G/Mb1snA3cf/0FN5Yr1oXaqGMOkjDSoSZ/ruV+ E+R/cIdzlT0smulGiHu0G7xz7bd/iROJg1GqIIVBV4+wJeqkQbptQJEDWgdAFUdLhxiG jc+cA290orBx+hkfATXg35iH36zjACZOSqatldTpxOv9yooUGudkSqXrdlyDU/LI6Ls2 mU4QN054v5KLr26myBhj6LbLS6YoVbjofPUHDqgiyr6DZC3UbyaBgXpYOn1D8zlUIqyR QEU3MU4L4K5EHpZ8e4/klNDlrgj68m3ay7vh3vznhPNXaSTH5vHYUBTpsReO7jRBpIrH Z+QQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=Zbt4AiAW; 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 d2si6654833pgc.146.2019.03.22.06.22.12; Fri, 22 Mar 2019 06:22:27 -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=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=Zbt4AiAW; 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 S1728678AbfCVNVk (ORCPT + 99 others); Fri, 22 Mar 2019 09:21:40 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:44700 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728330AbfCVNVk (ORCPT ); Fri, 22 Mar 2019 09:21:40 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Transfer-Encoding :Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date: Sender:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=hw3ZtZSh4y78LcwFC7knlBZdOdzIfUNtqXkI2P++IvI=; b=Zbt4AiAWGBY6okvEekZtK6TS4F PTLe64W03umLD5nMSHvoCMhFEc4lCxttGX4EneARFbw7Wk07uvTnz/Ir8Hl1nAuKuj3nWtYcwKHfG 4lnt+VewjSCFLnWQf0H6NwJw0adquIeo05Oj6qlq6AOFapqexQfI8VP518uRb7Pi5IqICBdl92ARY tDAnHXgUGavzntghHV+Bay6zLlMg1KYzVuN20T34X59Oc8MmgfVAJgxJQwa0GUnqoz9YSMbg9h/Ow IH3z+678WV11fgVbeRfilpWZX1p31/flKDOsK2UqdbN/QAWsLrzzQAqzjhUf2yTf9GSLzrZZqdNLG r47bHwFQ==; Received: from hch by bombadil.infradead.org with local (Exim 4.90_1 #2 (Red Hat Linux)) id 1h7K6x-00047T-Fh; Fri, 22 Mar 2019 13:21:27 +0000 Date: Fri, 22 Mar 2019 06:21:27 -0700 From: Christoph Hellwig To: Alexandre Ghiti Cc: Christoph Hellwig , Russell King , Catalin Marinas , Will Deacon , Ralf Baechle , Paul Burton , James Hogan , Palmer Dabbelt , Albert Ou , Alexander Viro , Luis Chamberlain , Kees Cook , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mips@vger.kernel.org, linux-riscv@lists.infradead.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH 1/4] arm64, mm: Move generic mmap layout functions to mm Message-ID: <20190322132127.GA18602@infradead.org> References: <20190322074225.22282-1-alex@ghiti.fr> <20190322074225.22282-2-alex@ghiti.fr> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20190322074225.22282-2-alex@ghiti.fr> User-Agent: Mutt/1.9.2 (2017-12-15) X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > It then introduces a new define ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT > that can be defined by other architectures to benefit from those functions. Can you make this a Kconfig option defined in arch/Kconfig or mm/Kconfig and selected by the architectures? > -#ifndef STACK_RND_MASK > -#define STACK_RND_MASK (0x7ff >> (PAGE_SHIFT - 12)) /* 8MB of VA */ > -#endif > - > -static unsigned long randomize_stack_top(unsigned long stack_top) > -{ > - unsigned long random_variable = 0; > - > - if (current->flags & PF_RANDOMIZE) { > - random_variable = get_random_long(); > - random_variable &= STACK_RND_MASK; > - random_variable <<= PAGE_SHIFT; > - } > -#ifdef CONFIG_STACK_GROWSUP > - return PAGE_ALIGN(stack_top) + random_variable; > -#else > - return PAGE_ALIGN(stack_top) - random_variable; > -#endif > -} > - Maybe the move of this function can be split into another prep patch, as it is only very lightly related? > +#if defined(HAVE_ARCH_PICK_MMAP_LAYOUT) || \ > + defined(ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT) Not sure if it is wrіtten down somehwere or just convention, but I general see cpp defined statements aligned with spaces to the one on the previous line. Except for these nitpicks this looks very nice to me, thanks for doing this work!