Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp5002884rdb; Fri, 15 Sep 2023 21:47:27 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFnF6aF+sfz5vu89hWgL2Rst74t3wM2+1oSonxeb+tF+oWD2TrZljszG8XlY/lJEkUYtYWA X-Received: by 2002:a05:6a20:1592:b0:153:7515:9919 with SMTP id h18-20020a056a20159200b0015375159919mr4595636pzj.21.1694839646529; Fri, 15 Sep 2023 21:47:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694839646; cv=none; d=google.com; s=arc-20160816; b=shEgsp3FPLgdz6R6R1ZLRB6WQax5/pphnCXBmgz5AGtrJIIfFqtyhXK3VG6euO3dp5 uf8RoskUCTRiPdCnV6t+oWwYIPbBpvPZ1EJnOIutErjirWFFkU/PVeehH8nr6nzZLutS bY/wlewzkVzuMsz9IV9RctR2GStqvV4DXkerCh9fYIKTIvX/KOk/U8LmRgFr1qFrzglU 1kAMTyBewdTcAUZXxKmiNI5A7p42kFiLJ/Cp9xxp31u5C6SWtCJTBoQjA35jDLduo3Ja M62wVAVt3VgorsGZ1qia7oyzc3pcNU76+a+GC3tVIZ2SU5F2EQLAUlC1uIT0zRBjUCjj O1Ow== 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=f5vxbstncXGDTYF4k8iBAO/uRU8zJv+hlaWNzlrq5m4=; fh=/rLEvaXnGBiRM4EX9+wDYvvcWBZOUvcJ+CTY/6BJP8U=; b=Sdui3jw9oMUEE2oz7iyWbV8OFL3i8VLCvq7K5qKa4nMG+39Dupdcpc4wVN3xeBJORm 7PwdMHrv1sMES+mvIGe+HM3PRgEc2+G2xW1b9F2gF8TZfFOKJbQSE5JtooCK/IBROKUd YU/FY37rand2GS0qXZXf3rfJcE/ITuCFdG+8gZod1S0pDeUoK9aFWnSTu/4uDiiVj3G0 kKNTcQ3tYKXfvDdWCfw9ylae5cxS8WdckR7qwZEhpKdijF2jM9Hpf8DtQY97cv2ayw/R 0o3Q/d6QwhQjvsjGxUgUO/jseKQFTtyAR6fobTR5ZLqWcqVGzAS0tGcy0zAHIxwY2myk bPQQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b="fWK/ibyb"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id o66-20020a634145000000b00577796b5206si4270670pga.898.2023.09.15.21.47.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Sep 2023 21:47:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b="fWK/ibyb"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 snail.vger.email (Postfix) with ESMTP id 39FA281DA3A5; Fri, 15 Sep 2023 11:28:43 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236348AbjIOS2L (ORCPT + 99 others); Fri, 15 Sep 2023 14:28:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59794 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236071AbjIOS1n (ORCPT ); Fri, 15 Sep 2023 14:27:43 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B7BC52D60 for ; Fri, 15 Sep 2023 11:26:18 -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=f5vxbstncXGDTYF4k8iBAO/uRU8zJv+hlaWNzlrq5m4=; b=fWK/ibyb6ETNzkHlnHyn9gX1RS Fmd7YQNPRUfcacHqJp6y9G+nRfF0x6E75zxeHzf95FBuFmoCiiZe1a3cJDq+Gfm8sreTmj3EajlvQ JF7/jGs0EwsxeHvQyg4ZySBqsCi2XtlteoDCDTl9bGfG2ophERMZ89K++B9Z7YHXlbCXQobz03emV Yy5XRpP3xa/DHm84iSkQcAtBmaAOyjQlyOCrXQuYqLpDROULAcbUJiXNapPCyB6bnhxDndGxG/p7R jie1+97gfLzKQQYMkh3q7MRww2A2G78LL5GQ4xtZ0fHnnHCUBvE+jJZawlNIePSdb1jFk9Wm/7gma 9y8MlWZw==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1qhDW7-00BJSR-LJ; Fri, 15 Sep 2023 18:26:11 +0000 Date: Fri, 15 Sep 2023 19:26:11 +0100 From: Matthew Wilcox To: Hugh Dickins Cc: Suren Baghdasaryan , Yang Shi , Michal Hocko , Vlastimil Babka , syzbot , akpm@linux-foundation.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, syzkaller-bugs@googlegroups.com Subject: Re: [syzbot] [mm?] kernel BUG in vma_replace_policy Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_NONE autolearn=ham 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Fri, 15 Sep 2023 11:28:43 -0700 (PDT) On Thu, Sep 14, 2023 at 09:26:15PM -0700, Hugh Dickins wrote: > On Thu, 14 Sep 2023, Suren Baghdasaryan wrote: > > Yes, I just finished running the reproducer on both upstream and > > linux-next builds listed in > > https://syzkaller.appspot.com/bug?extid=b591856e0f0139f83023 and the > > problem does not happen anymore. > > I'm fine with your suggestion too, just wanted to point out it would > > introduce change in the behavior. Let me know how you want to proceed. > > Well done, identifying the mysterious cause of this problem: > I'm glad to hear that you've now verified that hypothesis. > > You're right, it would be a regression to follow Matthew's suggestion. > > Traditionally, modulo bugs and inconsistencies, the queue_pages_range() > phase of do_mbind() has done the best it can, gathering all the pages it > can that need migration, even if some were missed; and proceeds to do the > mbind_range() phase if there was nothing "seriously" wrong (a gap causing > -EFAULT). Then at the end, if MPOL_MF_STRICT was set, and not all the > pages could be migrated (or MOVE was not specified and not all pages > were well placed), it returns -EIO rather than 0 to inform the caller > that not all could be done. > > There have been numerous tweaks, but I think most importantly > 5.3's d883544515aa ("mm: mempolicy: make the behavior consistent when > MPOL_MF_MOVE* and MPOL_MF_STRICT were specified") added those "return 1"s > which stop the pagewalk early. In my opinion, not an improvement - makes > it harder to get mbind() to do the best job it can (or is it justified as > what you're asking for if you say STRICT?). I suspect you agree that it's inconsistent to stop early. Userspace doesn't know at which point we found an unmovable page, so it can't behave rationally. Perhaps we should remove the 'early stop' and attempt to migrate every page in the range, whether it's before or after the first unmovable page?