From patchwork Mon Sep 25 08:29:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hugh Dickins X-Patchwork-Id: 13397484 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 3B86CCE7A81 for ; Mon, 25 Sep 2023 08:29:35 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id CA87E8D0014; Mon, 25 Sep 2023 04:29:34 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C58DD8D0001; Mon, 25 Sep 2023 04:29:34 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B215C8D0014; Mon, 25 Sep 2023 04:29:34 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id A411D8D0001 for ; Mon, 25 Sep 2023 04:29:34 -0400 (EDT) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 7D1C3807DE for ; Mon, 25 Sep 2023 08:29:34 +0000 (UTC) X-FDA: 81274445868.13.8B592D6 Received: from mail-yw1-f176.google.com (mail-yw1-f176.google.com [209.85.128.176]) by imf13.hostedemail.com (Postfix) with ESMTP id B95872000B for ; Mon, 25 Sep 2023 08:29:32 +0000 (UTC) Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=oNluEmAL; spf=pass (imf13.hostedemail.com: domain of hughd@google.com designates 209.85.128.176 as permitted sender) smtp.mailfrom=hughd@google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1695630572; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=HPVWJplZZXmT6NBbA8O4nkrJWg/FlNHzJ5g3rgEWw70=; b=yUT5GEjXGR52aGLZFhj3CyvKiF5GoiLteCfXCFtbRaMUTgZ0EXdIRV4VA1t+ISQhES8mw0 iCRauQX+q3OX+XMhzZr98RpB+3ovkYLSQJZPHLC7shK/q7pG2iayoWhJjW3oRAwVM2H2Eu UilwZzm6iGCmdNUHfyZI2Gp4PqWHnoA= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1695630572; a=rsa-sha256; cv=none; b=DCFCfbLkR33L9GSbq9hZRUSC7epRVxvm0XBW5ApTbWHYCvQBgdwdO/fDhIfvAiAhUmqNpx ZqzPWLkgT+Svq83jRlWHGWu/i9xRIMtG5o/rADSTq9ozaPPgTLB98+2QcxwMsh1DE+hVzU PigbLp0M161L15b+NtgUIcpVWokiY/I= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=oNluEmAL; spf=pass (imf13.hostedemail.com: domain of hughd@google.com designates 209.85.128.176 as permitted sender) smtp.mailfrom=hughd@google.com; dmarc=pass (policy=reject) header.from=google.com Received: by mail-yw1-f176.google.com with SMTP id 00721157ae682-59be6bcf408so68552377b3.2 for ; Mon, 25 Sep 2023 01:29:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1695630572; x=1696235372; darn=kvack.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=HPVWJplZZXmT6NBbA8O4nkrJWg/FlNHzJ5g3rgEWw70=; b=oNluEmALoq48QgFa5UIDVRYhWp8JGcee159wyC0aHbiVhaN1QciCMwqY8gGMEX9xex rDG8C6CXV3ZDGKr0Li4R8zViiPAehopRtApKpr0x0HzsGeaLwauLMJzTl3gQt4KLHZ+v GnVy90x5mbpQv2clBTLddnh2pCmqA99BJgDU0n5xX5Pm3XGsBdGus0p7Rb/Fzd2uYf1t Y01Y3iKFCssQb4n4GhQX6OeWyYUrzoBwDgkNwFVRYCtFdGnhhDvHJz5yU5Pq1RyijIVD UwUymS5fveBEeA+TiAByR2klHt4rcPwVibEk/DxaKcZEyezO6CvMpk88p3G89q9qUCNb 3CYw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695630572; x=1696235372; 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=HPVWJplZZXmT6NBbA8O4nkrJWg/FlNHzJ5g3rgEWw70=; b=nYnIckSmKKq3XDsgvQWWJuhzidnCL/mf/c9okXX+NxLnikUDML+CNUZjp27BMMaMVT klcVU3/kCwpaj9i69+7ctUqMNyWekcx/Pez+w5mrV3YK7OyXfu2+o+rDxUfRK1CR5gNj YuLvxV0V/JVM0+dEg2FVEhoqjqjVqWLrC4aaZPz0TnkhRihe/Ng2hA1HgrYKcN6O5fH9 qXxW4U2PADnTtwMZb/w5IOd3l+Pb9Yw1weCDfj5EPZrfjAzIlralSaPAdXTyMxSbe4iu 0YZEeMzYJys08ZrTvabSrlcrlkQLFZyvCFE+sQD7F5hkpv/djb7lGCCXHDOd5m0DACBP sDVA== X-Gm-Message-State: AOJu0YzTPAwlPR6+Ef4IdKKNm4gzL6W+jvUswTy9sAXPUsEFTWrKaMWK Puu0P0nS+EEr5OGJ0lwjCTOADw== X-Google-Smtp-Source: AGHT+IHogreXDslqhpyk+Ms3XFo/uXGtPLAXb4cvDc8C5nh9Ehy9UaqEagZCyCvQ6vw015lUH0Gb7A== X-Received: by 2002:a81:52c9:0:b0:59c:c79:eeee with SMTP id g192-20020a8152c9000000b0059c0c79eeeemr5778750ywb.44.1695630571804; Mon, 25 Sep 2023 01:29:31 -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 c64-20020a0dc143000000b0059a34cfa2a5sm2259385ywd.67.2023.09.25.01.29.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Sep 2023 01:29:30 -0700 (PDT) Date: Mon, 25 Sep 2023 01:29:28 -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 , linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 07/12] mempolicy: mpol_shared_policy_init() without pseudo-vma In-Reply-To: <2d872cef-7787-a7ca-10e-9d45a64c80b4@google.com> Message-ID: References: <2d872cef-7787-a7ca-10e-9d45a64c80b4@google.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: B95872000B X-Rspam-User: X-Stat-Signature: 9e4uzw5shkbntswi89s55ww8iesa96ss X-Rspamd-Server: rspam03 X-HE-Tag: 1695630572-315139 X-HE-Meta: U2FsdGVkX19Sh2O8YJx9+dKhdICyknnvKwTCZnCi2YX3neGymp+WmE3nhtK/B81HiDvJ5HOnbtd2/kT553AqkxwBftjWp2niIFT+8KEvGMLoOIDgP4dwWjL5P2i2gK2FJf1xpqojiLofAiyBMQGWKTLeE+N+j8CQowHIx3UoQ3oULJI38Gh3HO7e0gE1ICrxK0N+KnGMoDeTtOJQe3rAmlsbpM3cNd1+giZKFHPvYgJMAxXEnWsM3U8oN4x/rUBiJOT5Ht4mr/EiPQ5LPZsRi/gAQPJOjbsLvFu5A/IdFVIXsEaByIkD4+aC8dx8XY1iSifzRWBD3Bb1+YGcGAWxca0o8UfwXuk2fhBO5iu6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Bum5QJDIh8srSG2ZJGdU2vkCH/TYRLn7VAR1mymXYWSN6T6HeXDjOflkHhPl8TyVETcPrAsISL32SYCE 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: 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 | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/mm/mempolicy.c b/mm/mempolicy.c index 065e886ec9b6..a22b641cfd6b 100644 --- a/mm/mempolicy.c +++ b/mm/mempolicy.c @@ -2749,7 +2749,7 @@ void mpol_shared_policy_init(struct shared_policy *sp, struct mempolicy *mpol) rwlock_init(&sp->lock); if (mpol) { - struct vm_area_struct pvma; + struct sp_node *n; struct mempolicy *new; NODEMASK_SCRATCH(scratch); @@ -2766,11 +2766,10 @@ void mpol_shared_policy_init(struct shared_policy *sp, struct mempolicy *mpol) if (ret) goto put_new; - /* 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 */ - + /* alloc node covering entire file; adds ref to new */ + n = sp_alloc(0, MAX_LFS_FILESIZE >> PAGE_SHIFT, new); + if (n) + sp_insert(sp, n); put_new: mpol_put(new); /* drop initial ref */ free_scratch: