Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp5140787rdb; Sat, 16 Sep 2023 04:56:39 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFi5R24Ge26tmDRgXs7zi3Yi/J84T/9GRTYf0bOuS/W8RmGo9VsAUPiNpBxrI2ErUJ1hrwV X-Received: by 2002:a05:6358:9217:b0:13a:a85b:c373 with SMTP id d23-20020a056358921700b0013aa85bc373mr4563097rwb.18.1694865399669; Sat, 16 Sep 2023 04:56:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694865399; cv=none; d=google.com; s=arc-20160816; b=IxtZPZL2jHZi/AVMVC/Aeu6KIYV3d7nNA4g4XuhLEyNVQII3rVkF9ZHdRRZwLMTrGl BZLONf6Bk4huRXi0p3dQaCyMCyvDTuhKoXgkzIfCnT4f7rtN7nPRC6m07joH1zJm9PgB tahygZwVkHIBTkFTeN/FdxsYN9siLYoP186hbG4qFVY26xKkc1Fl6AYMNIHILwdK97mH KOTIOgaXxAPEJAo++gzd2mExQquwz57GiEPFL2H7X7Uk+qJpX13vcxhrKXPTpipRXB50 a1bXCIiUVnVdoILjsN6fmi9Bl8hAkX8fBluQ9c3NDYRi67zpnNxtoKaUFwQjJe4iH+dg C75w== 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=pRgYEKeBnhc137LJPUJ1YX5jXl/+dvV/D/bsE7EFVFU=; fh=DzX2X3q8O0kLgQrAARdUFup3sseiiw95u11BkrFmETc=; b=N4gZTHoCGek5S8OmQ6cDRiZevOrUUmBNSVvVRheXBWqmg/denroqN/VeRpjohkhyZh QAAsTCCjehPSAMmRAi7A2kgqlFy0lo+m0ARXSlpRk3PLfHbjJFyL0nX6QlXAMPpB+jnH COotrZg3dMdMOy8rtY/7pQlKiF1xXANzOqzIQ9OwLXd3Pbdikp+b4ZsKr6+taC8d1M2G B6zgDCZnFZhHBO3CaIyGkGQTrkUFge4uDlejLJadG1mbOYZRYVEd7Ao/htYtQnfnsI1H 0Mk/wCW+0QdqwFl+88agBN6zMbZZcx4EkMYKvfoBJ0IsYTac+TfcK7OkjjTIXI7exrgJ jv5g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=ruaSHKEQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id o189-20020a6341c6000000b00565e42df278si4738391pga.759.2023.09.16.04.56.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 16 Sep 2023 04:56:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=ruaSHKEQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 snail.vger.email (Postfix) with ESMTP id 6F35880FC720; Fri, 15 Sep 2023 19:59:01 -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 S234914AbjIPCyo (ORCPT + 99 others); Fri, 15 Sep 2023 22:54:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52146 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231539AbjIPCyZ (ORCPT ); Fri, 15 Sep 2023 22:54:25 -0400 Received: from mail-yw1-x112b.google.com (mail-yw1-x112b.google.com [IPv6:2607:f8b0:4864:20::112b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 19C9A1BD2 for ; Fri, 15 Sep 2023 19:54:20 -0700 (PDT) Received: by mail-yw1-x112b.google.com with SMTP id 00721157ae682-59c26aa19b7so7637437b3.2 for ; Fri, 15 Sep 2023 19:54:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1694832859; x=1695437659; 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=pRgYEKeBnhc137LJPUJ1YX5jXl/+dvV/D/bsE7EFVFU=; b=ruaSHKEQKnnwpWuTTIeLxtcg3C4ijVzzFj7/rAGJGT6xzsobYUlPuZ5VsLKvi1TqWI zPPjMa+kR0HW9p3PtE/1eH5MgXgFt0n/GLJh6s3EuOgtqmejdKZPHnYwNXrpwBK3Sw6P uPRlb0c+eQUMgrrEUODBgD8KW6yGMI2YTXBcRrZuxmVWFSwSEeTta4mSoX8jF0oQF2TV EzT6/xQ/v5/0BjCS1loytBSf6AnzcE4NRezshCbhgrP5QPcROsXwIx4IRg2YbjObfrvo G7EZLtb6F62FUdJnWb34U54AR6mAaL00itz3wv9OIp+ba8GVQS2VqSRtoZ+8HtIoGX4N C76A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694832859; x=1695437659; 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=pRgYEKeBnhc137LJPUJ1YX5jXl/+dvV/D/bsE7EFVFU=; b=LF+0vynr1NIVj9ReBwT3oFnYTDmVK9ii6olUTOEBQK79G77T9kj0SAbjREEDAIpmF6 HWC7RBpL7VLXGNfXwT3sYR20BFWb92POQrmM0pU0fWKd0xMmfO6tU0L+kUxC40W06VkY uwvcjj8NbZUy+xkYENXZwYclEB05rYYqjGakmW6Q8ufPmD6jMuE3/jaBtl1qB0jQeyY7 4O9DeQJ898Ah9i6R+5+7RfdeBcCJN+bi3TOaL+PKA937maeHP8tTQ9tnl1ejT+2A5dVT 2fFpWHZ4POLG8cfIOAQ0t2mzdCI1MM9Ju9EQx7oDO0L9Hn8aXmOT5F+ZE8dWkaOlI1BH naqA== X-Gm-Message-State: AOJu0Yw81nhUbkBBPZmP1dcJ/T84TMmx2rgW/JvJwQBjAuDq79gX/eyP TS/mEU9N5fftKIHHms4Sh93TWA== X-Received: by 2002:a81:73d5:0:b0:59c:3f8:b0ab with SMTP id o204-20020a8173d5000000b0059c03f8b0abmr4202510ywc.41.1694832859109; Fri, 15 Sep 2023 19:54:19 -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 u127-20020a0dd285000000b0059bce30a498sm1196082ywd.139.2023.09.15.19.54.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Sep 2023 19:54:18 -0700 (PDT) Date: Fri, 15 Sep 2023 19:54:16 -0700 (PDT) From: Hugh Dickins X-X-Sender: hugh@ripple.attlocal.net To: Matthew Wilcox cc: Hugh Dickins , 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 In-Reply-To: Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL 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 19:59:01 -0700 (PDT) On Fri, 15 Sep 2023, Matthew Wilcox wrote: > 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? Yes, that's what I was arguing for, and how it was done in olden days. Though (after Yang Shi's following comments, and looking back at my last attempted patch here) I may disagree with myself about the right behavior in the MPOL_MF_STRICT case. Hugh