Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp1521214rdh; Mon, 25 Sep 2023 15:52:16 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHCvyG1PhNMO5G4rmqiAJCOcmU8X4aJU/NeFSRnd46YbZXZiJknKEkQ8PY3b3VT9kleac1Q X-Received: by 2002:a05:6358:919e:b0:141:51d:4d48 with SMTP id j30-20020a056358919e00b00141051d4d48mr8455971rwa.17.1695682336016; Mon, 25 Sep 2023 15:52:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695682335; cv=none; d=google.com; s=arc-20160816; b=y4q/w9+OOrGtQaVwOQLVuOsJFdv5EpBE9Dls2RM66DtlovYHaUZb0+GNF+8hlYJkLf WmWClpIihBWIcgRgeAwFqSFrEtfmAfLFHqd0LnStHne1p/KDjlsD4faZepa6j5IN2XX4 xQj4gTPORH4n91qQ8BagX3tS7KbVWylOkkyAzc45UHJS0AHOSOMLcGl93gRshu2O5Daz +hmDXYSgTmX6eK6HDONwU+Zg7frgRVX0L8V1WWIZ04JonDhpMj5qAE7+Oy3ps+1JwTzc QS8mFVVITxPVTroSmCUwhBcGTbrWQjfWs3qWUDj6Y2E+oU6KAU3ELKf/DyPmCa7/f5+p yyzw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=fkpEMEA5GrodGGnTXvAzWVCKUrI8tAWka+urpqQ/HT0=; fh=Yibd+6efQ2NbloUNqjhUgqChaOBGlXVnr6VE1C45OVo=; b=M3fGk/UwwBsCGS+7BfeeSvrJRZNsn1VRcB8/GA2OCYVf1e1uXOYg3KEndZjacZGZ6+ QNnLKaSTCBuvhReqeLZdCM/kJuhK5XNNnbqEjontTZTDYpLnEsz1iHCH1skUnnzf+SPd OTIM2yrx1N8aIOledWCllmLLN9V8obNdSixunGcni6QEHal65JvU54crz6RytbyHuPoB w6yNYyy1F90VzNsGk4IS2ISynHFyhIyTO/lMtlQPBnzrp03/fzVmpvpDuaEzCIt4YX+r G1CkXhaGxuW6fgMNtDUaIQcyPsz7iATBdtCGknYzOnR0T0liT+3FdT6fFbyviR6mp4Qa rfGA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=fW8kU+Fn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id y21-20020a056a00191500b00691023321ebsi11367466pfi.113.2023.09.25.15.52.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Sep 2023 15:52:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=fW8kU+Fn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id 78B21803D58E; Mon, 25 Sep 2023 15:51:24 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230084AbjIYWvT (ORCPT + 99 others); Mon, 25 Sep 2023 18:51:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54982 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229585AbjIYWvS (ORCPT ); Mon, 25 Sep 2023 18:51:18 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B189DCE for ; Mon, 25 Sep 2023 15:51:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=fkpEMEA5GrodGGnTXvAzWVCKUrI8tAWka+urpqQ/HT0=; b=fW8kU+Fnbdm+zP6pBUarKlT0N7 jjaiHlrjVoxGHFLkB9uLWHfdGX4E6MHfSnZZHVB69oZGq5z7KNriYlyK53K0tjzR6Zh49ceBDJzyp NplP8BnOUM9FByS5qLgA8RgZyVx2T67OCJ+jfwLh2+OavJogFSqrYmCRL28g70UOTmV1xtuRFyhsz CIIl2F3mVFXiDTZpW+W1K8LIhnjrE/jl3lkp1bsSkqvROQfz7g2hiGNaQnaL9EephW/f6o8mGwHaq Ke7BLp1J3J/R2AIYx+WPS8b06H9ac/K30HZtXCD2VySIYucaw6alemgfh2AYH+bNzwmkKAj8u4YBp dozksdjA==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1qkuPl-0048Wp-6m; Mon, 25 Sep 2023 22:50:53 +0000 Date: Mon, 25 Sep 2023 23:50:53 +0100 From: Matthew Wilcox To: Hugh Dickins Cc: Andrew Morton , Andi Kleen , Christoph Lameter , 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: Re: [PATCH 07/12] mempolicy: mpol_shared_policy_init() without pseudo-vma Message-ID: References: <2d872cef-7787-a7ca-10e-9d45a64c80b4@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.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 (pete.vger.email [0.0.0.0]); Mon, 25 Sep 2023 15:51:24 -0700 (PDT) On Mon, Sep 25, 2023 at 01:29:28AM -0700, Hugh Dickins wrote: > + /* alloc node covering entire file; adds ref to new */ This comment is confusing. sp_alloc initialises the refcount of 'n' to 1. Which is the same memory referred to by the name 'new' in __mpol_dup(), but in this function, the name "new" refers to the mempolicy called "old" in __mpol_dup(). > + 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: This is all a bit inefficient, really. We call mpol_new() to get a new mpol, then we set it up, then we dup it, then we free it. It'd be nice if we could donate it instead of copying it. Maybe you'll do something like that later.