Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp3080605lqp; Mon, 25 Mar 2024 20:33:35 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUrMNKl9uRxoIZtYQG6fEsfSXix/gztb3keQ7l3Hej6XLpy5N6HTcpZ9949PFAz3FqiyVvdsn4irlIbrUiSiJ4JsucMrawZEcNeTzU0JQ== X-Google-Smtp-Source: AGHT+IHiXyHUGdDLwE7DdFyBL1KgBpRrvwt91PfIpM/HnD/9g0AXz/Uj1AQKV7nlfy/4DZjrEw+k X-Received: by 2002:a05:6a20:1591:b0:1a3:9f87:f389 with SMTP id h17-20020a056a20159100b001a39f87f389mr11130636pzj.38.1711424015132; Mon, 25 Mar 2024 20:33:35 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711424015; cv=pass; d=google.com; s=arc-20160816; b=vv0zHNBL5mViVZ8EdEY8J8/vJNYmtbjWxOoCMxdvqu9OUITlx3gRGeo9rOBFU2kb9S /kD7p5ABwqrFZVNIRx/+KUYqUkKq6mo2mFzg7pGbJeR2tIWknviPgQ2eDetcyM6Xzrax 0GVY2nHgOZ3QpodZsxX5Hg7GKuEnSpWEuUTv5Z9vyWMMCMx/TG98KCzGG53808mum9La VN/020uwJhufQPWgisOyj6p/dHdFkED/fP74oc5GGj8i4vYTbumaRHqxGsz4ZWFcgvYM 6MPr80LGwqVbSb5UP/sO3f+mxZaZk/Lha3pDUM4sby44FqdYMcJgiiYAQ6yzeX9d4v/9 TPwQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=lA5o6h754u6ODWqcXZI/yfZmhgXKlz5ceCEo4tpQucE=; fh=ZgHK6AbHzGy/c6Qega4x92BvjhD9GddhJd2Dnm/5uiI=; b=SYFkHwUDNtfW/ij6il4Xib5bGR/KmPSym0Xhmw6fHcAbDPmmV8s2Qenkz1dHLOV/4Y /s8Z2mtSWZ0dXMmp1/1+sobzEM0dfK2UKo8YVORVnUaM7ITom7Toxij91YpUcswXcq5c Nyzb8l/lgD4q0pOfb3eQKbke9feq/F0wBFPGylVb5JpqFNUfgNehzB3MiF2w/mIvyiAB 3T2G5JKI1ptZiscjwtBpRkIKeS75J6ju+cxKwsz0xTNVEx8nXr6zK+OMnukSw2b/gQNu 6wvh69ToahPj9tODO2Qtducdpueoq6bzNU15jRxG1ymUhPI51Qhx+VtCSRgifgWH6QPD IQMA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="GQ/yKgv4"; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-118336-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-118336-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id fi28-20020a056a00399c00b006e6bd8c2cdfsi6544174pfb.181.2024.03.25.20.33.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Mar 2024 20:33:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-118336-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="GQ/yKgv4"; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-118336-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-118336-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 908E62A6ECD for ; Tue, 26 Mar 2024 03:33:06 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 532A512A145; Tue, 26 Mar 2024 03:32:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="GQ/yKgv4" Received: from mail-wm1-f47.google.com (mail-wm1-f47.google.com [209.85.128.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D637F128823; Tue, 26 Mar 2024 03:32:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.47 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711423974; cv=none; b=PLrxTrwdjILWshfjMuC5XDmwSW/IMqKlj9FqLkUyO1KIt8GRkUfPuJbIhkC2JX61fkpqwbNF7ITxMW6Pm0CM4KQUiEEp0WpAiMv1qfuxAnVNCJsoryeaiFb6jR3cKkwpJzVkQuXOiw+OsIK5HqIfpwotPjH3VEKPl9caz3gU67g= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711423974; c=relaxed/simple; bh=f5P7jXuaPxF8gxKTJOiUPKZMuLKQpBGNZmyCMdfpQew=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=W8AGvVYmbVUe2apVdz2PsqbPJLgZQSM/KTAOfUD01iaYVo2ZMihkLuX9HAWNCoMwYKUsWAoNAQKu8LyM3KyBqleOwEy0bpgzUuPxFU//s0GFX3sbIuqmt9ji0GzmL1Uffn5h8/1Mg/sa7QspryVqnCUKldOdm70XjBWKMZOhlbI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=GQ/yKgv4; arc=none smtp.client-ip=209.85.128.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wm1-f47.google.com with SMTP id 5b1f17b1804b1-41488d6752eso10821765e9.2; Mon, 25 Mar 2024 20:32:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1711423971; x=1712028771; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=lA5o6h754u6ODWqcXZI/yfZmhgXKlz5ceCEo4tpQucE=; b=GQ/yKgv46sqFnSCBelHnAnN508cFDTH28rJLuZ6V2bjpScVQ3HKjJalz+ylvKz2hmB DBF3ShSXyxxp6u0Kh1ZhSdVJ8hxor/zl5vsZPXMp20oXODQvp5897+fIEUkKcf93x8mL KBbtYe3H2NGGyMYstb37YLWepFJmicNDM/0G0InWzIDnL7gjDG5InDxMlTPBz/nxPNab 7cPgbPTjscyAqu5npqXXomA8HAwVfxqTr3TXc4svWbzx41gzXXtezxDS1rc1mJ69ESi3 E5ybo69ULxBgoZgrSVqtEtktM/wdkmCLjC9ch73wt+VrBL4JzbIiZoZ9S87j9hApctwr aEmg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711423971; x=1712028771; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=lA5o6h754u6ODWqcXZI/yfZmhgXKlz5ceCEo4tpQucE=; b=N0klvxvfSE8JxEsdNayWaepFKiRxCYeXN4J1qGYyqy6Tl5G1NkaUHbJsrZWINdG+gh imcVFh7GREh5T9bAALkEHRZG0U88I4Strc90PB2zUd1lQqfYuOM12FlnzDT8VfsegaDY bSSiQlase5SvGmWJcXcvrfqOIlOFmUJNl7sScAloJNZu86gu8pB9tyX6bdiMtdIUaYcB ZUPFY/dbvyO+hOCl8v9mdHxijLUi+yB/tL7Y7/u0C+CoNDx3KFMO+zyDzyFw4DkO+HOB z/SaDAkpcO7WAVKgomKrb6t+D8OUqETOKztnEpoozB088OsswWeZuQFnQy+LytRdcWpP fyjA== X-Forwarded-Encrypted: i=1; AJvYcCXt9vUv1hboSJIa2Wk0CGjD1afSVZLRfkz3WSs2uB+fCN65VGYGcmrmRcOfoG4Xs4iKa8chh2WPpcHwo05wQLJltymwj2gQ1X8OJxtW4tq7vtGeV1EstlKt9JT+ekJWHrLEeX+Yg8cRddUlA23iz7n+lW0jjQb96hOWwJhQOgcriKDZAEVBKUoLG0T9E6OpuprnBS2pBKUH15e2XVku5Ifj1qiJFwq3MB4XCEwqIN67kdpvlH0aoDHYJc17pqJ1E5aBxcBNSVhKjATrKvk3NIBb6MgWtcXcbfybFCQwwlBlXgSjJ/OwEDAeTNYxT5JmB/r2qQlCN+3Uma/G+KUoFfNRkT+BBWg8dEc= X-Gm-Message-State: AOJu0Yx2L+Ugcmv/iPcXz+KA1Brw1i6kPdtRDEdgyN7EpNBACsVJs0tc NXCkdqwe6fTxnLigincKMPvAT7kV0WCeCuq0mxzZijtq3AI4i0vtMjhznrefb+Iv7GQA/uroAZ9 LDyiTZLKcC2GOHr9ryTmt3djgMus= X-Received: by 2002:a05:6000:120d:b0:33e:a5e1:eccc with SMTP id e13-20020a056000120d00b0033ea5e1ecccmr5218777wrx.68.1711423971122; Mon, 25 Mar 2024 20:32:51 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240326021656.202649-1-rick.p.edgecombe@intel.com> <20240326021656.202649-3-rick.p.edgecombe@intel.com> In-Reply-To: <20240326021656.202649-3-rick.p.edgecombe@intel.com> From: Alexei Starovoitov Date: Mon, 25 Mar 2024 20:32:40 -0700 Message-ID: Subject: Re: [PATCH v4 02/14] mm: Switch mm->get_unmapped_area() to a flag To: Rick Edgecombe Cc: Liam.Howlett@oracle.com, Andrew Morton , Borislav Petkov , Mark Brown , Christophe Leroy , Dave Hansen , debug@rivosinc.com, "H. Peter Anvin" , Kees Cook , "Kirill A. Shutemov" , Andy Lutomirski , Ingo Molnar , Peter Zijlstra , Thomas Gleixner , X86 ML , LKML , linux-mm , linux-s390 , sparclinux@vger.kernel.org, linux-sgx@vger.kernel.org, nvdimm@lists.linux.dev, linux-cxl@vger.kernel.org, Linux-Fsdevel , io-uring@vger.kernel.org, bpf Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Mon, Mar 25, 2024 at 7:17=E2=80=AFPM Rick Edgecombe wrote: > > > diff --git a/mm/util.c b/mm/util.c > index 669397235787..8619d353a1aa 100644 > --- a/mm/util.c > +++ b/mm/util.c > @@ -469,17 +469,17 @@ void arch_pick_mmap_layout(struct mm_struct *mm, st= ruct rlimit *rlim_stack) > > if (mmap_is_legacy(rlim_stack)) { > mm->mmap_base =3D TASK_UNMAPPED_BASE + random_factor; > - mm->get_unmapped_area =3D arch_get_unmapped_area; > + clear_bit(MMF_TOPDOWN, &mm->flags); > } else { > mm->mmap_base =3D mmap_base(random_factor, rlim_stack); > - mm->get_unmapped_area =3D arch_get_unmapped_area_topdown; > + set_bit(MMF_TOPDOWN, &mm->flags); > } > } > #elif defined(CONFIG_MMU) && !defined(HAVE_ARCH_PICK_MMAP_LAYOUT) > void arch_pick_mmap_layout(struct mm_struct *mm, struct rlimit *rlim_sta= ck) > { > mm->mmap_base =3D TASK_UNMAPPED_BASE; > - mm->get_unmapped_area =3D arch_get_unmapped_area; > + clear_bit(MMF_TOPDOWN, &mm->flags); > } > #endif Makes sense to me. Acked-by: Alexei Starovoitov for the idea and for bpf bits.