Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp784560pxp; Fri, 11 Mar 2022 15:04:23 -0800 (PST) X-Google-Smtp-Source: ABdhPJxcJOxPuZqAPXo9razkOY/6gXATadyUsUJPXALEnesQgqSCWMvr7mm1gUP/011lGLzj5npH X-Received: by 2002:aa7:9199:0:b0:4e1:9243:b625 with SMTP id x25-20020aa79199000000b004e19243b625mr12541067pfa.21.1647039862953; Fri, 11 Mar 2022 15:04:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1647039862; cv=none; d=google.com; s=arc-20160816; b=k96J40p6DOz4Y1lVbYiAvtd8AWe3vCCGEQnN433ta+9qti7nrH5FXUXPmQkCti2ERg oB0TPJMlHcTTQyQXlzMEVxT/QflD/j2qskWil8ZeGYnIitGsO0A6/r6DMzDPOcuTg9NQ H3qxVEt6cykwkc9yu+i5L6stiYJaxf5yNV2IUBcLJ9gkQ2dF07zRz1m2lgCLPLhmdz/i nxHfgKuRvbQtT9S0vHyAYhJLP4Ezm+Wp/Obd8eJUB1OWt5f5fjH20tSEopg/MOgLnsIa 7HiYsCAS6ejxhAdM3g0QYM8cm8oOBuiMji12x0OMMm+mbRAYZIOwcVt0VWVM5FxrsWSC PrBg== 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=vpPcHMluYAXV8Paw7JGI4S73DN1T1jhxT9j/EEXlW3Q=; b=CL23TQPKYVVKyXF46QHl+Iwul42AFRbUsu3Zx/86iRJ/rLVZN2rfdBPixETTfczSQw x4aWCSbRo1oMpPjTyTnhw4A8jhEqgevCyBUbIqfQ7F0zJgDORFsJzQ6vvgftUvUkGnwD XtXfUNHcru9jFai+lqs4t2DB8EFszahVQkO+cjEzbBmayJP6DDgvQ/qmN5yNk8VPjOAO waSMhR0yXmf3Qz1n/P1gGZesUQfcftVWQvffBgL8GsvRTnzTGXeKSPWiQTxPBoQoJ4mi kjYZLkNqBAO7LJVfl35U63Du4d/Ew1MdFXgCZiXjqNoeMlij8xSzshDWyx8dQ3xUdT/Z HiSA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=mp3Eia2d; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id d1-20020a636801000000b00380a9f71a1asi8304743pgc.837.2022.03.11.15.04.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Mar 2022 15:04:22 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=mp3Eia2d; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 1B20D385620; Fri, 11 Mar 2022 14:00:18 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347513AbiCKJeN (ORCPT + 99 others); Fri, 11 Mar 2022 04:34:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46044 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347477AbiCKJeM (ORCPT ); Fri, 11 Mar 2022 04:34:12 -0500 Received: from mail-qv1-xf32.google.com (mail-qv1-xf32.google.com [IPv6:2607:f8b0:4864:20::f32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 26F711BE0DE for ; Fri, 11 Mar 2022 01:33:09 -0800 (PST) Received: by mail-qv1-xf32.google.com with SMTP id e22so6556297qvf.9 for ; Fri, 11 Mar 2022 01:33:09 -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=vpPcHMluYAXV8Paw7JGI4S73DN1T1jhxT9j/EEXlW3Q=; b=mp3Eia2dyVOCG0jbYGZw65g85ozfSFa31ZZnBTRpOm+QoI1uYrxH7NMKYYBAZ2OZBy xIzHAKF98navsEfg8UdZd3RyGPRiL0EDWgCatPtRH19MJXQ/8R/nuigafMDRjL1wBmGe Y7AldwHbOXRuAjwnbpFrLmvU1uSZNiWR0J+C3UgZm3zakPqlRLp8/4UupqdWDG5ZNAAS 2qE/5gL+ttv6Rcl6iITcIe2xEGKDFtcX/3GCutQnN8xcYqDvNIHOXqPKoGFcEEokRKkY Q1G1/QwmgSi1JA99opOxjStXLjHYe6KZ3dpi5ofoh37oHmYh4CFpTeyyCal5+YuYx9ex 1fng== 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=vpPcHMluYAXV8Paw7JGI4S73DN1T1jhxT9j/EEXlW3Q=; b=oeR/5n95ANWXlEQsTawDl/2MHYWoqb2WFtotL4SaxpjEJiSKB2l8qx+ouBV1agFg3r 2KTYTfcEtLqyzsg/DRq5azg+bf+9Y72CNTikljWG+buLKCUIqDqfckNsL7Jr81kqnI69 c2MhAqRpsszbqmEB4tGa6+yH4JMUqdMeezl7cOjfpiupte/ylM29cRVRuj3ERjOfg8WN FlejFXODL9XPKdaH4ecg10bwEPVVKq2NQ6BnQqDaBdTRxpafVjqz1jdCoDqweS2gakqC HvLy8Oqz5rYmi6sRJGgZbarB/+Z93R95P/9ZrOlP16hPm/6xl07kTnm0r+bRcUPMP7Of r1kA== X-Gm-Message-State: AOAM530Dw5B0Wg7ZQTWWuh8KlRUfZcoffme1WDn4g86wbc1/B7LbPmGL mufpiOisZoTc7Cfnm0TCWlAN3g== X-Received: by 2002:ad4:5dca:0:b0:43c:5758:480a with SMTP id m10-20020ad45dca000000b0043c5758480amr493049qvh.77.1646991187966; Fri, 11 Mar 2022 01:33: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 y196-20020a3764cd000000b0067d51bbacdfsm2184830qkb.107.2022.03.11.01.33.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Mar 2022 01:33:07 -0800 (PST) Date: Fri, 11 Mar 2022 01:33:05 -0800 (PST) From: Hugh Dickins X-X-Sender: hugh@ripple.anvils To: Liam Howlett cc: Vlastimil Babka , 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: <20220309191023.34fmzibc2u5tcinw@revolver> Message-ID: References: <319e4db9-64ae-4bca-92f0-ade85d342ff@google.com> <20220304184927.vkq6ewn6uqtcesma@revolver> <20220304190531.6giqbnnaka4xhovx@revolver> <6038ebc2-bc88-497d-a3f3-5936726fb023@google.com> <20220305020021.qmwg5dkham4lyz6v@revolver> <29eac73-4f94-1688-3834-8bd6687a18@google.com> <20220308160552.d3dlcaclkqnlkzzj@revolver> <6036627b-6110-cc58-ca1-a6f736553dd@google.com> <105e1620-5cf2-fecd-27e7-21a6045cc3ac@suse.cz> <20220309191023.34fmzibc2u5tcinw@revolver> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Spam-Status: No, score=-9.5 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE, USER_IN_DEF_DKIM_WL 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 Wed, 9 Mar 2022, Liam Howlett wrote: > * Vlastimil Babka [220309 07:41]: > > On 3/8/22 22:32, Hugh Dickins wrote: > > > > > Does that help? > > I think so. You want to set the mpol the same across the vma because we > are specifically calling mbind, but it isn't necessary because the mpol > is equivalent but not the same mpol? I did not understand that logic, so cannot confirm it. The crucial point, as I see it, is that a call to shmem_set_policy() was needed in many cases, but had been "optimized away" by the mpol_equal test. > I guess I have the same question > as Vlastimil brought up - why does tmpfs need this? One way of answering would be: because tmpfs is used to back SysV SHM, and "man 2 mbind" has a paragraph on the subject of mbind on a shared memory region created using the shmget(2) system call. Or you could look in Documentation/admin-guide/mm/numa_memory_policy.rst, section on "Shared Policy". (But it's a surprise to me to see how that makes no mention of tmpfs itself: it's as if it's just an accident that this is how NUMA mempolicy is applied to mappings of tmpfs files.) An important comment from ChangeLog-2.6.7 when mm/mempolicy.c came in: For shmfs/tmpfs/hugetlbfs shared memory the policy is shared between all users and remembered even when nobody has memory mapped. (But although hugetlbfs support was intended in the original RFC to lkml, it was never implemented in the tree, despite appearances: a patch I did not send this time, but eventually will, removes the appearance of shared mempolicy on hugetlbfs.) Hugh