Received: by 2002:a05:7412:251c:b0:e2:908c:2ebd with SMTP id w28csp2017139rda; Tue, 24 Oct 2023 09:46:14 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH0yMGsDeNkPGhpIduzlDg0tn9qj9oLxnxme5sIFJ32kIy1yvWJ5qHGj/xa53EEGsjahD5x X-Received: by 2002:a05:6a00:1488:b0:68a:54e5:24e6 with SMTP id v8-20020a056a00148800b0068a54e524e6mr14305172pfu.8.1698165973974; Tue, 24 Oct 2023 09:46:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698165973; cv=none; d=google.com; s=arc-20160816; b=GGQ24kj35X0JyE/faQTb+bl+EMhmPh4fSXftVgyaNoF/2migsgsXQ/1XrQgUprAP40 QqcxUN9NXGd3AVjWBDHl05T9V7liUbpKR181Kg4HGF3/mnjWKPJ8ykVkAv5M4B9tqkiX 0AWAy8MTyG45DONoSxOuJlfFPcCEtUJl8J5YeLahOy4//7WgtqC6REehwFwX2+5GS87T V5CWj2KbuHv3fn/6z/Bq1Ydd3m2EIs/Dv1SJWboOhqPpVLJeXvbJ7hLzCvU2J5g2RxKq HWszNmfTyyhZFKE6ks9WUcH76dU3VJ1v4lJcUcEv+/ScSekCVU5BM9LOC2Q4PYhBJoUz LK1A== 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=GMAFTNtWnm12yWRaZ75O/gVwatB6p/CE7HbexbbR0y0=; fh=X+YsLexw6+fBgDyXQeUZEVc4VTVYZHNJjgpC01E/MoE=; b=X7aXTQCa+lNyj4WytDqFu9C2jCfgZ0NuiEjVLe7KQ43vP1o0rSjSLkPflZw0Xucnek SCrt5/9NHte5rRhgQHeNlsfLxRTgTwsJu9OZTpu4uqsHh8XYKh41hAklADmWc3vxcUrc OyU1lLzUiFEwZ6f8FfxkCe0+cbtERlKK8ZXke4WcB7ViENAvx74AjeqbSp5tk9+OyIxE QwmPPfu9n2UpBytajT2bfddzJZHLYxLvnPgrfooYJtm2H7LZhDy2YMhoZn5hv7IuhGau kqaRXNoRH3QsGLVnaQTTUY3RpVmXywgolxdA2RY5F6lld2AMzC8Jzs6/Fz9xBKuqg/6o cjQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=h3hHKUaz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id bv193-20020a632eca000000b005859c81f1f0si8371510pgb.137.2023.10.24.09.46.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Oct 2023 09:46:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=h3hHKUaz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 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 morse.vger.email (Postfix) with ESMTP id 03A8F80936D7; Tue, 24 Oct 2023 09:46:11 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232602AbjJXQp7 (ORCPT + 99 others); Tue, 24 Oct 2023 12:45:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55228 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232308AbjJXQp5 (ORCPT ); Tue, 24 Oct 2023 12:45:57 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 69E1112B for ; Tue, 24 Oct 2023 09:45:55 -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=GMAFTNtWnm12yWRaZ75O/gVwatB6p/CE7HbexbbR0y0=; b=h3hHKUazF0w+AqrXJZ52L1PY03 1HrNDOZfLL8fBSNuoERzU7wgqScFvATDv1ljjww3j/uKx1NFNf+DPPCXTqCev7jUanoHcVYgaQYH7 AvU2RlteoElYKLtB1IIvC9j4Pb4vbo6pnQt+fjvHNFJjeRwgyCnSwjlbFBQxYxfmlkEMZlBLJKgCa f1G9B2GFd4PBXXhwxnJDDrV0Od29dBCbcT9uCZ6h3LSkyqgW2xhtikkjd4Xg9A7G9wu+k4I9IY5Oc WVaccXT/6OUjtp0XR14Vfm2w6IaCjxlbkCDuudUqsSxAEDYF3djLW2dqfSu68l9TfeUqL0pXWTxvt hRs4Yqow==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1qvKWm-003aXc-7J; Tue, 24 Oct 2023 16:45:12 +0000 Date: Tue, 24 Oct 2023 17:45:12 +0100 From: Matthew Wilcox To: Hugh Dickins Cc: "Liam R. Howlett" , 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 , "Huang, Ying" , linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH] mempolicy: migration attempt to match interleave nodes: fix Message-ID: References: <77954a5-9c9b-1c11-7d5c-3262c01b895f@google.com> <3311d544-fb05-a7f1-1b74-16aa0f6cd4fe@google.com> <20231024151827.i7e2f6cheet4k5h5@revolver> <5b570bcd-e0fb-4473-7cfc-81b8b53d7712@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5b570bcd-e0fb-4473-7cfc-81b8b53d7712@google.com> X-Spam-Status: No, score=-0.8 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 morse.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 (morse.vger.email [0.0.0.0]); Tue, 24 Oct 2023 09:46:11 -0700 (PDT) On Tue, Oct 24, 2023 at 09:32:44AM -0700, Hugh Dickins wrote: > On Tue, 24 Oct 2023, Liam R. Howlett wrote: > > > * Hugh Dickins [231024 02:50]: > > > mm-unstable commit edd33b8807a1 ("mempolicy: migration attempt to match > > > interleave nodes") added a second vma_iter search to do_mbind(), to > > > determine the interleave index to be used in the MPOL_INTERLEAVE case. > > > > > > But sadly it added it just after the mmap_write_unlock(), leaving this > > > new VMA search unprotected: and so syzbot reports suspicious RCU usage > > > from lib/maple_tree.c:856. > > > > > > This could be fixed with an rcu_read_lock/unlock() pair (per Liam); > > > but since we have been relying on the mmap_lock up to this point, it's > > > slightly better to extend it over the new search too, for a well-defined > > > result consistent with the policy this mbind() is establishing (rather > > > than whatever might follow once the mmap_lock is dropped). > > > > Would downgrading the lock work? It would avoid the potential writing > > issue and should still satisfy lockdep. > > Downgrading the lock would work, but it would be a pointless complication. I tend to agree. It's also becoming far less important these days with the vast majority of page faults handled under the per-VMA lock. We might be able to turn it into a mutex instead of an rwsem without seeing a noticable drop-off in performance. Not volunteering to try this.