Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp292618pxp; Sat, 5 Mar 2022 04:31:40 -0800 (PST) X-Google-Smtp-Source: ABdhPJyCuQW90Di2D8vHCR1IxU64JQjNUtO2FKkvj3cgRhg7iBV0AY2rFDowlSn28r52rCQmorym X-Received: by 2002:a17:907:7fa2:b0:6d8:2397:42 with SMTP id qk34-20020a1709077fa200b006d823970042mr2669151ejc.218.1646483499882; Sat, 05 Mar 2022 04:31:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646483499; cv=none; d=google.com; s=arc-20160816; b=YlF/M9Qdivl4yCefmFjAvPlItlJ9kx0h3TVCtqPY1rgS8OyEEPL12YWn1+l9FxBG2p wZtsaJq3RZOYjTAMEKnxy+oU0ZYT40VXoDEZriwRtDDASk3vjsgmI1LgsgCoqX4NtJgt ifgQMMuYvUfUUwDvNgNMcpFJN5E/6jSF8pm71cWkZNtBF4SjM9U7+qe0mdTStzufDt5v EPg1gcbXGG5Frf4b4vRb3fq9vHW+1c7l9jBSY5aam94rACyXFY/sFaq9G2Cn54g+JEyi jnKOgx74juogBkPSwm+WtNkbDoO57aHvfDyUE80f57B1zUrr/MIS/hugbZ0y+ekdrYmL 8w4A== 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=Hbm5TQmw1l7ulFWRyo3PHqo3g4u481T5gjdYr0TUKCE=; b=pVd3s91bZ7PFG4fd8Yth61nyit2CbxaTAHJJrtu4Uvx3irKYDYnLEOL8F/abMpnOHW RpAtT3CKyE1z1DWBak+IAyQz7127nMHMKRuyoWCzxphd4zi52PmA0prkmjO+6kiYfzep nXe4EGnq+Yq0uZBCcb5yEJLpmAXb50vZAgJdCQPxwyJ0KU6FnvcraRtgRD4a8mr9py3g Ey+f5M+Bc0K6fMrq+mxJUHHA3KqMtgxrTxq88Uk+E6phBk0+G4eY6Tqmp4HcvIOQDETu rIX1e6NaGEMtKWMmXeHbt69VDKyzKrXnCPPLxgoaKmeBTYXPxhGZllYMXGQ1hJuDdCfO CmDg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=AkMbkY1e; 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 o8-20020a170906974800b006d033984eacsi5557329ejy.68.2022.03.05.04.31.14; Sat, 05 Mar 2022 04:31:39 -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=AkMbkY1e; 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 S230138AbiCECaA (ORCPT + 99 others); Fri, 4 Mar 2022 21:30:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44286 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229565AbiCEC35 (ORCPT ); Fri, 4 Mar 2022 21:29:57 -0500 Received: from mail-qt1-x82b.google.com (mail-qt1-x82b.google.com [IPv6:2607:f8b0:4864:20::82b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0F6CD54F9C for ; Fri, 4 Mar 2022 18:29:08 -0800 (PST) Received: by mail-qt1-x82b.google.com with SMTP id s6so5651235qtc.4 for ; Fri, 04 Mar 2022 18:29:08 -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=Hbm5TQmw1l7ulFWRyo3PHqo3g4u481T5gjdYr0TUKCE=; b=AkMbkY1eAnNbHGBkJymyFX3/nVr8dWYsyjBZHMm57+Uz14pt9E+foHVje2wkScfWZ1 sFd1/4MrHiCMeA3VZaJ+mNY21yj9hVY62p1c7EHoHpELnHSJ43T+coUtbncZZZjXgrQf MnIxg1LeCQ+GBo0Kp9XuFJ3weTzYffVMxSsIT1MNzDni3nQ3gksyWMALlSckh3NF0fZV hNcHIg82bWugN0GGk67XeXw7L9zt5I137Wd1cvyWGcPm2JBqbFrwPYto657CNRIDJOR7 Gr5Uf+kbKwUujOhOjp2/ENpvEe/9EO9Q529LzAEiLATuRwxYdwFZweHPtnq8PQzwvlJP ED6Q== 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=Hbm5TQmw1l7ulFWRyo3PHqo3g4u481T5gjdYr0TUKCE=; b=GKpCDxP91LZQJOKcFDKNUM3JsOecbSuj0bTMEVt66j751omOVrcZSzYr1dnE9ySQJD Mgnv9YUmZR4KCaj+dVGG5vRE7UUfDMj1CmBgISiLL6461DA4qLUTk0kVqbfe6pCC5AFC wYDrQhXuPYd/IJJUspLiSSMUp6Dy7k8kTZ6X27cyz5Xif4GudJQOmllng/UmmmgRWKrK jIRA5dTQpEc8nEeZOphInQfWG1etIbASif7Zx/Ki0K6Sb2J/AQg45eEwjBedV08Avdu4 EmTkG7rrjioYMPN/86sW22FNhNp3EJhUDcYvBEGday1YvEedFrjesy1hhCfNYozbYc9Q fr3A== X-Gm-Message-State: AOAM532ZeteC7f3v0vy9o9DarG90YtmxY4ApueZJcn7WE1BY0AdkQNH8 Iudxbr8YOpqZ7vJT5if6Zeqq0+62CJ252w== X-Received: by 2002:ac8:5c14:0:b0:2de:2b69:dae7 with SMTP id i20-20020ac85c14000000b002de2b69dae7mr1436589qti.185.1646447347043; Fri, 04 Mar 2022 18:29:07 -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 v14-20020a05622a014e00b002cf75f5b11esm4508896qtw.64.2022.03.04.18.29.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Mar 2022 18:29:06 -0800 (PST) Date: Fri, 4 Mar 2022 18:28:39 -0800 (PST) From: Hugh Dickins X-X-Sender: hugh@ripple.anvils To: Liam Howlett cc: Hugh Dickins , Andrew Morton , Oleg Nesterov , "linux-kernel@vger.kernel.org" , "linux-mm@kvack.org" Subject: Re: [PATCH mmotm] mempolicy: mbind_range() set_policy() after vma_merge() In-Reply-To: <20220305020021.qmwg5dkham4lyz6v@revolver> Message-ID: <29eac73-4f94-1688-3834-8bd6687a18@google.com> References: <319e4db9-64ae-4bca-92f0-ade85d342ff@google.com> <20220304184927.vkq6ewn6uqtcesma@revolver> <20220304190531.6giqbnnaka4xhovx@revolver> <6038ebc2-bc88-497d-a3f3-5936726fb023@google.com> <20220305020021.qmwg5dkham4lyz6v@revolver> 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 Sat, 5 Mar 2022, Liam Howlett wrote: > * Hugh Dickins [220304 17:48]: > > On Fri, 4 Mar 2022, Liam Howlett wrote: > > > * Liam R. Howlett [220304 13:49]: > > > > * Hugh Dickins [220303 23:36]: > > > > > > I just thought of something after my initial email > > > > > > How does the ->set_policy() requirement on tmpfs play out for the > > > mpol_equal() check earlier in that for loop? > > > > It took me a while to page all this back in (and remind myself of > > what is case 8) to answer that question! > > > > The answer is that the mpol_equal() check at the top of the loop is on > > an existing, unmodified vma; so it's right to assume that any necessary > > set_policy() has already been done. > > > > Whereas the mpol_equal() check being removed in this patch, is being > > done on a vma which may have just been extended to cover a greater range: > > so although the relevant set_policy() may have already been done on a part > > of its range, there is now another part which needs the policy applied. > > Doesn't the policy get checked during vma_merge()? Specifically the > mpol_equal(policy, vma_policy(next)) check? Sorry, I'm reduced to the unhelpful reply of "Yes. So?" If vma_merge() finds that vma's new_pol allows it to be merged with prev, that still requires mbind_range() (or its call to vma_replace_policy()) to set_policy() on prev (now assigned to vma), to apply that new_pol to the extension of prev - vma_merge() would have checked mpol_equal(), but would not have done the set_policy(). Hugh