Received: by 2002:a05:7412:3784:b0:e2:908c:2ebd with SMTP id jk4csp1834292rdb; Tue, 3 Oct 2023 02:23:23 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHDiufkR4u0eWQkpn/4xO5WX0L2ztl4u5+NlxEUbmy2H3uwq5UC/ookIIVOiFHMey3NDcjB X-Received: by 2002:a17:902:ef96:b0:1c6:28f6:954a with SMTP id iz22-20020a170902ef9600b001c628f6954amr12702031plb.64.1696325003576; Tue, 03 Oct 2023 02:23:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696325003; cv=none; d=google.com; s=arc-20160816; b=CblAqyFcisYYe4nVqPITiEL0jIfLTy1ZMNT79nfo+xI80RE2O3caTaI8J0jxB5ovPr Coni1bIL2Gzdbz7vLM5RSdEm4YWIHI0dbAJPDBd/10yeFLGpYPARS41elZx2yb/sMmfn QKwSnSBO4xK3agtIK1e//SP1v/fU0T5yl6ETrVUePRZEvVAgCmVqDMjkMIVMlXhZk8bt yW2IOeUOI2tYReTPlR5WGDpWkdy+91mYqUoZDeRcX2PTCeQ9MSt10rr8hMRbED4UOMcS 7DgoLJmGd5k/IATTWG5fJWeD9rqgi8y5/5w9WNJBivbd7H7SvSu9BZlw4B2+yFLtJ6d3 U4EQ== 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=Mzr/4uL62aOMXHcIAqfjDQcxRGe9jlWGjvKm9366txw=; fh=uua5dLukz2E+eiUjHQ3XQZ9nrmHo6GVFaq4ywUulylI=; b=SrtzGMZPynyQTa+yYltNO+Ao2PvdfZjsRlRkUCGOOIluEcyMTd4yqp+/WR7FoF6OY6 aHifcjKWc/8HkhYnF1bE4+jung13qwg1VHH8viVOtLy6OSVvm+7VPyP2sMxAmj1ZxhZ4 9wtnGtm0m5AJch71J2EUnP55V3xApgrX14U4HPqc6wlwmI+j2J+r/9xB65i3NejmRKnz bNQqaW9c6yEGB36tx8CSzv1QPU5PxM3c8xObcxhrp1Kqvk2WDlLjB03I4SBT6uRUfRnA vowQBLMee0ALd2kc06UmdTs9392K7+dGgEQv4ptWQlAyxo062mcNx7BhyI9AOG/WKGpV dD3w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=u2VvcG01; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 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 agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id cp1-20020a170902e78100b001c3a4fb5861si960095plb.517.2023.10.03.02.23.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Oct 2023 02:23:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=u2VvcG01; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 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 out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id EA6AA8104992; Tue, 3 Oct 2023 02:23:20 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239623AbjJCJXJ (ORCPT + 99 others); Tue, 3 Oct 2023 05:23:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54926 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239624AbjJCJXG (ORCPT ); Tue, 3 Oct 2023 05:23:06 -0400 Received: from mail-yb1-xb33.google.com (mail-yb1-xb33.google.com [IPv6:2607:f8b0:4864:20::b33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 585FFB7 for ; Tue, 3 Oct 2023 02:23:03 -0700 (PDT) Received: by mail-yb1-xb33.google.com with SMTP id 3f1490d57ef6-d865c441a54so734843276.1 for ; Tue, 03 Oct 2023 02:23:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1696324982; x=1696929782; darn=vger.kernel.org; h=mime-version:references:message-id:in-reply-to:subject:cc:to:from :date:from:to:cc:subject:date:message-id:reply-to; bh=Mzr/4uL62aOMXHcIAqfjDQcxRGe9jlWGjvKm9366txw=; b=u2VvcG01nUNwn5OWn7Il/uGa0HHiBypHthBaYP9WNSd552T6Q47T/pFLnvGuvLBWyz ShrNGkvODTNH7RDHrhX+xMp7/F0qvGwVnEgQ3r8fFkVlMjOBjN7qeNK0/jAOr8yJ6ufj FApIJ6NlDMs3KTb0QHPon+puNNkHyhEV/ARKT8VaMF+kwxNFjkIXP0v1Q57VO/xaLodP gsHrHw4XYE3KBWCLaemYNGH0fKa2TcVXpDtebWqvy6FWYYqUZPKByaE9Ptd/fDAQx3XJ aTs2W6N09uSBPnwP8hr1WabY9WYbM/zhNoqrfaMdm6gU7ALr00SMjalyQ8Y4FkiSg2RM zI/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696324982; x=1696929782; h=mime-version:references:message-id:in-reply-to:subject:cc:to:from :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Mzr/4uL62aOMXHcIAqfjDQcxRGe9jlWGjvKm9366txw=; b=esKIiP/hlP7YeSXPrhPBoIx6wwvoYBnzL/RxNFak9qc537YejnJM1LmJHjarFOIoA2 zp81I5urbhlE1KJIdKM8ECMuxjRAqgAfdKUhGoOq5T1D/Q1l080Zs1HBwmoASFuWo/BU p5Ht/3dEJZPYhNKOAGZvu6VvL1oxev7U+SCcaqXIe04vMvg2lfFKY0DrtLtCO9B0Z4hC g3+EK6+WzELlLE3p63XAWOHEzyIlvxWVwmc/xX8VQ9IZ1r5N2zO17DaCqhOqEJhzPWNu RiqQEelHYWls3iVvdH5+D588r3yVUxHp7bUx0D0O/Kcor7S+cIuVbvcArjYETOGQU1/I IkZA== X-Gm-Message-State: AOJu0YwGL5qBRhrqwCAxiEf3oU1YEvRomK4k6iqH5psv10UNQ4S2YyYT D7CqHJOlfzEwXalv7wkGMCWKDw== X-Received: by 2002:a5b:c89:0:b0:d81:599f:a538 with SMTP id i9-20020a5b0c89000000b00d81599fa538mr10809754ybq.51.1696324982333; Tue, 03 Oct 2023 02:23:02 -0700 (PDT) Received: from ripple.attlocal.net (172-10-233-147.lightspeed.sntcca.sbcglobal.net. [172.10.233.147]) by smtp.gmail.com with ESMTPSA id c6-20020a259c06000000b00d816fa23bd4sm280649ybo.26.2023.10.03.02.23.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Oct 2023 02:23:01 -0700 (PDT) Date: Tue, 3 Oct 2023 02:22:59 -0700 (PDT) From: Hugh Dickins X-X-Sender: hugh@ripple.attlocal.net To: Andrew Morton cc: Andi Kleen , Christoph Lameter , Matthew Wilcox , Mike Kravetz , David Hildenbrand , Suren Baghdasaryan , Yang Shi , Sidhartha Kumar , Vishal Moola , Kefeng Wang , Greg Kroah-Hartman , Tejun Heo , Mel Gorman , Michal Hocko , "Huang, Ying" , linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH v2 07/12] mempolicy: mpol_shared_policy_init() without pseudo-vma In-Reply-To: Message-ID: <3bef62d8-ae78-4c2-533-56a44ae425c@google.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Spam-Status: No, score=-8.4 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Tue, 03 Oct 2023 02:23:21 -0700 (PDT) mpol_shared_policy_init() does not need to use a pseudo-vma: it can use sp_alloc() and sp_insert() directly, since the object's shared policy tree is empty and inaccessible (needing no lock) at get_inode() time. Signed-off-by: Hugh Dickins --- mm/mempolicy.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/mm/mempolicy.c b/mm/mempolicy.c index 1d3f9e1ecbb8..5d99fd5cd60b 100644 --- a/mm/mempolicy.c +++ b/mm/mempolicy.c @@ -2756,30 +2756,30 @@ void mpol_shared_policy_init(struct shared_policy *sp, struct mempolicy *mpol) rwlock_init(&sp->lock); if (mpol) { - struct vm_area_struct pvma; - struct mempolicy *new; + struct sp_node *sn; + struct mempolicy *npol; NODEMASK_SCRATCH(scratch); if (!scratch) goto put_mpol; - /* contextualize the tmpfs mount point mempolicy */ - new = mpol_new(mpol->mode, mpol->flags, &mpol->w.user_nodemask); - if (IS_ERR(new)) + + /* contextualize the tmpfs mount point mempolicy to this file */ + npol = mpol_new(mpol->mode, mpol->flags, &mpol->w.user_nodemask); + if (IS_ERR(npol)) goto free_scratch; /* no valid nodemask intersection */ task_lock(current); - ret = mpol_set_nodemask(new, &mpol->w.user_nodemask, scratch); + ret = mpol_set_nodemask(npol, &mpol->w.user_nodemask, scratch); task_unlock(current); if (ret) - goto put_new; + goto put_npol; - /* Create pseudo-vma that contains just the policy */ - vma_init(&pvma, NULL); - pvma.vm_end = TASK_SIZE; /* policy covers entire file */ - mpol_set_shared_policy(sp, &pvma, new); /* adds ref */ - -put_new: - mpol_put(new); /* drop initial ref */ + /* alloc node covering entire file; adds ref to file's npol */ + sn = sp_alloc(0, MAX_LFS_FILESIZE >> PAGE_SHIFT, npol); + if (sn) + sp_insert(sp, sn); +put_npol: + mpol_put(npol); /* drop initial ref on file's npol */ free_scratch: NODEMASK_SCRATCH_FREE(scratch); put_mpol: -- 2.35.3