From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0844AC433EF for ; Fri, 4 Mar 2022 22:33:40 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1D4468D0002; Fri, 4 Mar 2022 17:33:40 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 184458D0001; Fri, 4 Mar 2022 17:33:40 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 04C488D0002; Fri, 4 Mar 2022 17:33:39 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.a.hostedemail.com [64.99.140.24]) by kanga.kvack.org (Postfix) with ESMTP id E5F528D0001 for ; Fri, 4 Mar 2022 17:33:39 -0500 (EST) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id A3F5320A6 for ; Fri, 4 Mar 2022 22:33:39 +0000 (UTC) X-FDA: 79208156958.02.BBD6A67 Received: from mail-qk1-f181.google.com (mail-qk1-f181.google.com [209.85.222.181]) by imf19.hostedemail.com (Postfix) with ESMTP id 37ED41A0013 for ; Fri, 4 Mar 2022 22:33:39 +0000 (UTC) Received: by mail-qk1-f181.google.com with SMTP id q4so7572269qki.11 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=aDkWUOOtRr8uphwCs2/HDJQj/i+fUF6tOe+Eup3mytj3nAoZqAPlIPc45FVqtWCADU wZGd/lz45dOZXtJLqE9WKXJ6VF4VmA+ExrVMHddjBkfrgIZ2b4gvLlNZ7z2whqAB1fPz w6GQ5Z+L30vF7f+YgvJyPwpU02xY9NGjbbTG57zIWj/y2bJ7B5lfGNe2sH0wuKVTo3zB 3S7zKdROZ5RsdZN+GlYKG5Q7gccjbBMzi1AkjEuuj2tGd7OD7DlLPDoABivwZoXzyHJA H38YmeY01lIOFygx537aEEI3fh/X9ObvFja3BFKxb0lFTNFA1Gs2briLXBHWdoW/x3r/ SCzA== X-Gm-Message-State: AOAM533Z12Wdc2Rpxrop3xjq3uX6JZM5jUHK21y4ztfEii3GoFnEeYVS fwmrhw+desMsNTcY89rEPIfXRw== X-Google-Smtp-Source: ABdhPJzereD2bFlLlb34GoVSO0Hd6Wcxg+yk8n3xCRjqmGrB8nsKAi6PrzuzS5SDxuKwLZyHQNZpuA== 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-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 37ED41A0013 X-Stat-Signature: krdijhee4kfq6jnomkbq17ur3jiabgaz Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b="gRA/odwL"; spf=pass (imf19.hostedemail.com: domain of hughd@google.com designates 209.85.222.181 as permitted sender) smtp.mailfrom=hughd@google.com; dmarc=pass (policy=reject) header.from=google.com X-Rspam-User: X-HE-Tag: 1646433219-688744 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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