Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp1386444img; Sat, 23 Mar 2019 01:19:37 -0700 (PDT) X-Google-Smtp-Source: APXvYqxZHf8EWdunDnKj2tcMIZYLOErcBRlao5qcbXSkbJuBgv/NJHgqL4v7JA5AdOg3znH6+a+v X-Received: by 2002:a17:902:b60c:: with SMTP id b12mr13632998pls.261.1553329177196; Sat, 23 Mar 2019 01:19:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553329177; cv=none; d=google.com; s=arc-20160816; b=FolZY4WLxBgAwZ2w+h59Y4OadzuRdMmfY6vCHzbPnzU/6+kY9kXlEJwNbifJ3C0iUI RySXjezCM49ES26q76zAWsfixiJbtOX7ejDc6rLHz5XnHnMS1tJCxz2LvPUMtEi7XMyG tLdSSuGXq+vxOZ1K+Vun+w1M3bdbNQilC2D9+qnTI18GLLm5T1H0FePBmtZ+0VdgYT4I kMk48CfS8EKhZlSJIa6SIw9whgDhoKnaVJIRUkNzoZKR7Raj6AfaLjwAZzVXDz0eFbOo Tvz6kyg9tJI+D+SQRz+9dvW5Mag8F7gHvUxJQbB3rXxOLhKDs1JoMCG0y8rMAhUy8sLP I/Aw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=rmYWYh2u8sdH0+/BBr+kgYZSa7bB3woieUUd4MGeYmk=; b=H1RKTuxKGoVvuk9A4rZpA7up3fDiv2xVXAQdQFxnPcaJM/aQs3ycI7OeBpZB70CVZ1 MhM4nkulTMiYVMR3FQBUBhNKT2Y+jJGwWNk2vK7Gh6UPIHXzHcLNdwuVhC6yrumFX8gs DXZKPIaUO4xwgY3UbNs2VipxzH3vbNWaeENV2E8wfGAS9cFN1sdsSL8/gWGEheaGeOKn 8XFBaGkjHHoCknIPOfgA9FAatlvdn4kteb7RfwW620US5Udq/wCt4PAXH74Wv0k5Ol9C OIJ7qTH9azZTkwNSsF3ydQWnTTfEmfBfBoNnE7B+W7L4np5ft5PYf441/YDQiP7SpEYm QubQ== 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 l10si8561209pfb.283.2019.03.23.01.19.09; Sat, 23 Mar 2019 01:19:37 -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 S1726448AbfCWISJ (ORCPT + 99 others); Sat, 23 Mar 2019 04:18:09 -0400 Received: from relay12.mail.gandi.net ([217.70.178.232]:55443 "EHLO relay12.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726038AbfCWISJ (ORCPT ); Sat, 23 Mar 2019 04:18:09 -0400 Received: from [192.168.0.11] (127.19.86.79.rev.sfr.net [79.86.19.127]) (Authenticated sender: alex@ghiti.fr) by relay12.mail.gandi.net (Postfix) with ESMTPSA id 9811C200009; Sat, 23 Mar 2019 08:18:02 +0000 (UTC) Subject: Re: [PATCH 1/4] arm64, mm: Move generic mmap layout functions to mm To: Christoph Hellwig Cc: 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 References: <20190322074225.22282-1-alex@ghiti.fr> <20190322074225.22282-2-alex@ghiti.fr> <20190322132127.GA18602@infradead.org> From: Alex Ghiti Message-ID: <72751399-3170-059b-b572-b9b9986ca0fd@ghiti.fr> Date: Sat, 23 Mar 2019 04:18:02 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0 MIME-Version: 1.0 In-Reply-To: <20190322132127.GA18602@infradead.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: sv-FI Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 3/22/19 9:21 AM, Christoph Hellwig wrote: >> 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? Yes, I will do. >> -#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? > > Ok, that makes sense. >> +#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. Ok, I will fix that. > Except for these nitpicks this looks very nice to me, thanks for doing > this work! Thanks :)