Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp26781pxm; Fri, 4 Mar 2022 15:13:08 -0800 (PST) X-Google-Smtp-Source: ABdhPJwuji/9bWE0lsT5op7Fez04AydeyjNJTEI7d3xzTIduWyq0IGTnizvECX7Z3QIwYg0oiKI+ X-Received: by 2002:a17:906:4fd2:b0:6d6:f920:f121 with SMTP id i18-20020a1709064fd200b006d6f920f121mr814258ejw.467.1646435587883; Fri, 04 Mar 2022 15:13:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646435587; cv=none; d=google.com; s=arc-20160816; b=m0ZttMvgaxamMQChuucwXtIb3gTrqBOQDSJAmUEizuV1xr4WTneEozuEnwvIFrpVCY p/LvsdDggdWSUgG4Ta5hWS9EZdjHezo8TKYavLAgeWSFWB3qrPSApQjDrC3kf7SKG9Mi aGb32JeaiHSCzNQFBwW3SYoTQAuncm7CpJbuJmBGcx8+h0J0snZ1oL+e+X6bKJejLoS5 9zdkEO/R22L9jXJkLfZBLIp5GZJ/+ZHkGBUICYtmdZTAI2DK9WJuDK641zqKQUv/aX93 tnMS5jtBV5x24z8vdfvjo50CvwmwAUNJkvRmUkBqn5H/X1iKMmdZQ3QytQRVODTOF6cA coGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:message-id:in-reply-to :subject:cc:to:from:date:dkim-signature; bh=VnF5SiU5EKCLKwi41uZyCysuVJrgHXPJdzY01fJNaS0=; b=ylpKbgq6kzVEstaxiZjVc7PrqOXXd7ZAwp1lI3MumgZEktUEJSHWk4jofj7srJkU4Z BFjWAazbvpkSLtT557ZS1pgqjxWvcCZXOFHWHSq94TVD2KDb7sdQfVylS0m3n16cNx+z CAdt2PREgtP3DdtrYyezOwRaCbOpYfGACyaLQoix2nMiLbi0jwLVDQ0b9MDszWvRph3L dm4HBM6cVepPQ0SI27CdpSEKLwq5rMTlnFerRC/PHDSEI51hJFZJsEgKamvJwDOJFxv9 iEudkLVOnS8PP2HfDs+w/rSlZAHKiAy06gpLLFkZd+ZrURuIDebQ2iPhZ7mVhdzPCH+0 Yojw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b="gRA/odwL"; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k7-20020a50ce47000000b00415a12c07c9si3895772edj.584.2022.03.04.15.12.45; Fri, 04 Mar 2022 15:13:07 -0800 (PST) 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=@google.com header.s=20210112 header.b="gRA/odwL"; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229981AbiCDWea (ORCPT + 99 others); Fri, 4 Mar 2022 17:34:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38686 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229475AbiCDWe2 (ORCPT ); Fri, 4 Mar 2022 17:34:28 -0500 Received: from mail-qk1-x72f.google.com (mail-qk1-x72f.google.com [IPv6:2607:f8b0:4864:20::72f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6204E5D5D6 for ; Fri, 4 Mar 2022 14:33:39 -0800 (PST) Received: by mail-qk1-x72f.google.com with SMTP id d84so7584625qke.8 for ; Fri, 04 Mar 2022 14:33:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:from:to:cc:subject:in-reply-to:message-id:references :mime-version; bh=VnF5SiU5EKCLKwi41uZyCysuVJrgHXPJdzY01fJNaS0=; b=gRA/odwLAg4xYlwLDYSTSTk0NNmin7TutlFP+pye+5mH3RccpDLg2fXgsLTjHEVoJk 80ssccDMeOHXxl+vu/N9oOn2YJHxMhDRaGefTeyPfGclMuZGafjpLcQBQCNukS+PHnbQ D7uXFPJQmnNDY4KQxlde1/l4kov3nUNfJIeOFPvA/5a1bvy7SNutshtBJZ9c4fzZxDYa xUMFNITHHIn3PtnH6I4L3YXN8p6X2Qugw4K2WhbPkCac/4GHBcbVPJPYCXLGtaJitJN0 VAH9vKrmc5Ifx8r8FEF3qxZbnVOGEm4/5e2+pUK/p0ladNfnZh8hhV6t22IBrR0mW86p jDow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:in-reply-to:message-id :references:mime-version; bh=VnF5SiU5EKCLKwi41uZyCysuVJrgHXPJdzY01fJNaS0=; b=6iA4uucJVedrSEbmwPSWhjON7qn4YsHdZgH1veaCy5AJ4WNrEwYjFUtcpIWU6sy/gL GfkGPVkw6FuZiWCUlzGl/vdBEC9yq4VOxPv8oEVvttRt5lfv60FVrLVsZHboGqeBMYiP sD349ABxo8xSUdS4wMa71/Wy2bQzScEoYYfIbJrzjiTYBb4M64Cib4+LW2encrorr0Sf lnwq4FTN0g0LkXNS9FR/7IiSJZOfsatTvirudwEs3V7Hw8xldokS2RoOcZUp24nQ/7kU PMWoEAFbjq4tSoBNUCA1u1RP+1CpDztamxcnVZxI3ORvGeNLAmCKLTUILKpwWWBfGB3o FbUg== X-Gm-Message-State: AOAM5306tvPARWaD5xCLvi6TSnlve3Dh/wvBuEgnaVeUxCGv/z8+fFHN DV9I5a7qeUx4qZhhx80kn8hylw== X-Received: by 2002:a05:620a:2445:b0:648:ca87:d35a with SMTP id h5-20020a05620a244500b00648ca87d35amr579693qkn.412.1646433218312; Fri, 04 Mar 2022 14:33:38 -0800 (PST) Received: from ripple.attlocal.net (172-10-233-147.lightspeed.sntcca.sbcglobal.net. [172.10.233.147]) by smtp.gmail.com with ESMTPSA id t18-20020ac85892000000b002de3a8bf768sm4341912qta.52.2022.03.04.14.33.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Mar 2022 14:33:37 -0800 (PST) Date: Fri, 4 Mar 2022 14:33:26 -0800 (PST) From: Hugh Dickins X-X-Sender: hugh@ripple.anvils To: Oleg Nesterov cc: Hugh Dickins , Andrew Morton , Liam Howlett , linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH mmotm] mempolicy: mbind_range() set_policy() after vma_merge() In-Reply-To: <20220304180636.GD19636@redhat.com> Message-ID: <1ba9dc93-7f16-7ab0-16a4-4f253574972@google.com> References: <319e4db9-64ae-4bca-92f0-ade85d342ff@google.com> <20220304180636.GD19636@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Spam-Status: No, score=-18.1 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=ham 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, 4 Mar 2022, Oleg Nesterov wrote: > On 03/03, Hugh Dickins wrote: > > > > Just delete that optimization now (though it could be made conditional > > on vma not having a set_policy). Also remove the "next" variable: > > it turned out to be blameless, but also pointless. > > > > Fixes: 3964acd0dbec ("mm: mempolicy: fix mbind_range() && vma_adjust() interaction") > > I can't believe I ever looked at this code ;) ;) > > Acked-by: Oleg Nesterov Thanks. > > offtopic question... can't vma_replace_policy() check vm_ops && vm_ops->set_policy > at the start, before mpol_dup() ? You are probably correct, though that is not how I did or would do it. For me too, it's a long time since I've been in here: I have a large number of cleanups to mm/mempolicy.c, done in the early days of shmem huge pages (and leading up to NUMA migration outside of mmap lock), but never the time to carry them forward; and quite a few other people have made their own cleanups here too, so hard work to integrate it all. This particular patch here stood out in my mind as an actual bugfix: our people found shmem pages being allocated on the wrong node because of it; last time I tried to work in this area, I did pull this one out and push it into our tree, before approaching any of the rest of it. If I look at the last of our trees which had the full set of cleanups, I see that my vma_replace_policy() had less in, but mbind_range() doing what you have in mind, checking vm_ops->set_policy in between the mpol_equal() check at the top of the loop and the vma_merge() below it: with a comment "If set_policy() is implemented, the vma is nothing more than a window on to the shared object, and we do not set vm_policy and we do not split the vma" (then calls the set_policy()). But I think that depends on other changes in other patches (not setting vm_policy): now, just as usual, I absolutely do not have the time to get back into that. So, thanks for the observation, but I have to stick with just this bugfix for now (a long now!). It's good to hear from you, Oleg: stay well. Hugh