Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp22638427rwd; Fri, 30 Jun 2023 10:28:45 -0700 (PDT) X-Google-Smtp-Source: APBJJlFnLskgi4O2WsqlcUP6mMd3Fdq0bGpsmntzy2Ib6Bvu8lodiKLCwongPLpTtJgI02OqgkaY X-Received: by 2002:a05:6a21:585:b0:12d:2abd:73f8 with SMTP id lw5-20020a056a21058500b0012d2abd73f8mr2241234pzb.59.1688146125474; Fri, 30 Jun 2023 10:28:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688146125; cv=none; d=google.com; s=arc-20160816; b=G5kLyinhOnQN+SCiZ+RS3i30j5p1XNxtYVTb8MrIRA/JLlKyebofvqDgn+7yDGJrGd NuedWOFgfx9MfZ94DrZd8y/oR37enN0DosCM0R6FS76Y5IGGZwx1D6YnhQNhNdSuFyGV 9CvQPcjNHBoarYsUNPW6Lpx5TGBv57FalSUcecuCy99jz+i1fyUdrUuz5aG83BBwG3To VO/C2A6MOMfIr+lr2hzodCwNfLyAjFeMzd86bALR6Zm5K+Pc/pTOMP0Z8W01av3gQ4A9 vAcMZCO1Yb2BlmEzVzhFPx/tq+fjMCGK9tAp4VvnPC3jYQO+lGAXOEHVM2AivmHvaS/D 7xYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=U0PDtKbr7ijXKVXGOWfxwXRpuZD8qaZkn5kn5qp/Sek=; fh=Sb5R5yyc+q2sc/t7UHeminWnWcp5XK0lLz723NbqYN8=; b=qU/Sw6rFavVcDFningo8Qxyzly1/NFzhs+R+craEoDtAwdW1LSWXEAM4RCXEkC3jZn FccEJFt7zq7edzdvBY+YmPbGOKsS1XgvUr1VyGr9wJpMZoK9qYWD2Tnahpd2InrkauVQ SkXwMnDu/NP41RAgvWlcELs6bJzoaqrm2v5znXHvL1zWPIq42bmgnkk1fD/v5hpCfd+m IYfWZhiiija04VW41OsOAw+tHnYEQhNqk+5viOxMUKG78cn/ZbuVluyiJ7uZNql0YqWk xKI3IXBWOVJRQVHY97dDyMIYBWfQA/TufgdrA2LRI5RjsbtSHT7O4FBVdm0Wf53umqs6 aNmw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=ZJ4WyDcI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v8-20020a056a00148800b0067b51fca490si8589303pfu.248.2023.06.30.10.28.30; Fri, 30 Jun 2023 10:28:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=ZJ4WyDcI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232428AbjF3RVo (ORCPT + 99 others); Fri, 30 Jun 2023 13:21:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39280 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229957AbjF3RVn (ORCPT ); Fri, 30 Jun 2023 13:21:43 -0400 Received: from mail-lj1-x234.google.com (mail-lj1-x234.google.com [IPv6:2a00:1450:4864:20::234]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CE46ADF for ; Fri, 30 Jun 2023 10:21:40 -0700 (PDT) Received: by mail-lj1-x234.google.com with SMTP id 38308e7fff4ca-2b69a48368fso33365231fa.0 for ; Fri, 30 Jun 2023 10:21:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; t=1688145699; x=1690737699; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :from:to:cc:subject:date:message-id:reply-to; bh=U0PDtKbr7ijXKVXGOWfxwXRpuZD8qaZkn5kn5qp/Sek=; b=ZJ4WyDcIuqxvrl+ewKq6azbzQY14+MLu5j5WIbz3STR4cuReFcoYpWud7q7D1or0Ap N0jmeITxYPM1dnTKDkciY/11NtLyMbIvnZzUqpfHAVzCqd+yYdX019h2UgFr9lzGEcav jJvsDVYe5UiBit8lAcyPSya0SP4BZpcijWfqc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688145699; x=1690737699; h=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=U0PDtKbr7ijXKVXGOWfxwXRpuZD8qaZkn5kn5qp/Sek=; b=VYed7ID2D9ffr8QjOf+YPUB4ogrR1HMfs6soF03ut6y4hPsxUKFyrdpMcqj8Vjhp7j zqUmmUe8jY9r3KZsadXGsjFDBaHw+vrOAwnWeNUO4ZImhQwKi9axKeGt6U3RsWpDLt/4 F4oiC0bEu9M8r/kuNZgUBI6xUK7f2Rsxb51wMtRuUASBydVcpXbcDpok23ccx01KQ9Ci pcxqhTGP1/Vx9vlz+cH4ZbSXTY4LyebKfjRV6wfRxqAQ1sqeTZszHreJtwKKPxAPOhfn uD7FgTu1x+etsV1utWlPmzK/nbnK21JN5QoKGuJUwRuAbsTB3DApS1bxcGfUYWqRNUvr 9Gzw== X-Gm-Message-State: ABy/qLb5dzqpAaZSdfPt91lbVZTunUHVRYUdbzLo8LsiR3Fzx/VRXyvi qn3Ht74Msv8Dav5jLiT1RutEnYalHzpmMCtL5Mos2yzx X-Received: by 2002:a2e:8ed2:0:b0:2b6:a3a4:f7e8 with SMTP id e18-20020a2e8ed2000000b002b6a3a4f7e8mr2474112ljl.17.1688145698807; Fri, 30 Jun 2023 10:21:38 -0700 (PDT) Received: from mail-ed1-f42.google.com (mail-ed1-f42.google.com. [209.85.208.42]) by smtp.gmail.com with ESMTPSA id lc6-20020a170906f90600b0096637a19dccsm8216522ejb.210.2023.06.30.10.21.37 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 30 Jun 2023 10:21:37 -0700 (PDT) Received: by mail-ed1-f42.google.com with SMTP id 4fb4d7f45d1cf-51dd1e5a621so2533463a12.0 for ; Fri, 30 Jun 2023 10:21:37 -0700 (PDT) X-Received: by 2002:aa7:df84:0:b0:51b:ed1f:378c with SMTP id b4-20020aa7df84000000b0051bed1f378cmr2413618edy.3.1688145697543; Fri, 30 Jun 2023 10:21:37 -0700 (PDT) MIME-Version: 1.0 References: <20230630160519.3869505-1-Liam.Howlett@oracle.com> <20230630164135.725ewvttype5tt6x@revolver> In-Reply-To: <20230630164135.725ewvttype5tt6x@revolver> From: Linus Torvalds Date: Fri, 30 Jun 2023 10:21:20 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] mm: Update do_vmi_align_munmap() return semantics To: "Liam R. Howlett" , Linus Torvalds , Matthew Wilcox , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Andrew Morton Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 30 Jun 2023 at 09:41, Liam R. Howlett wrote: > > I hesitate to ask considering how much trouble I've caused with the > 32bit map flag, but I also wonder about the stack guard now that the > write lock is taken for stack expansion? Which part of it? We have a lot of special code wrt the whole thing that came from how we did the expansion that probably can - and should - be cleaned up. For example I didn't want to go remove our ad-hoc locking, so we still do that "mm->page_table_lock" thing. And I think the stack expansion does several things differently from the "normal" vma games in general, because it explicitly didn't want to use the normal "merge vma" code because it didn't do real locking. But you're talking about the general issue of having a stack guard area at all, _that_ isn't affected by the locking. That was always a real semantic issue of "we don't want user space stack growth to possibly grow into another vma, and because the stack growing isn't strictly predictable, we need to have that guard area in between to catch things when they get too close". So the stack guard isn't there to protect stack vma's from merging. It's there to protect users from mistakes. And then we have all those very rare situations where we *do* want stacks to merge, and the guard goes away, but we currently do *not* call vma_merge(), and just leave it as two adjacent vma's because we used to only have a read-lock. End result: I do think that doing the locking right means that we may be able to clean up some other code. The odd do_vmi_align_munmap() case is just one of the more egregious special cases. Linus