Received: by 2002:a05:7412:251c:b0:e2:908c:2ebd with SMTP id w28csp1484541rda; Mon, 23 Oct 2023 14:11:11 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGQ3r2JyXjrA0LAyXwxNuM75/J8cxqtRQu+ieNOrjNoZ4FC9XM3dBW/RlM3Z6avX8wH6I5m X-Received: by 2002:a05:6a00:1a09:b0:6be:2dce:cf5a with SMTP id g9-20020a056a001a0900b006be2dcecf5amr7966580pfv.26.1698095471519; Mon, 23 Oct 2023 14:11:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698095471; cv=none; d=google.com; s=arc-20160816; b=x+13VPp9r0HjGAtfSxJarzLg8ERMLDcPRgFipDP3/EFeYIagnTlIRUOFRxBhCiVkdt LeIiDOD+KBg4iAEWW2y3UPsnBsOxGhyutjP+lVCsQ4p6cKSPxgUiMnjy57rEknh18t/i G1zZcp+e65MJJ6NDpuQY1dOGDwt9xRqU03qGuiBNd3Iv8QLTQ9LSRCs5ZBKdCr10jBoG L11zJbU4aAvWM94m0wU77po0ySkZeY7o6765qXHKB3rM98ihmG3w5OEYsWq3OZYMdUIe hHw/679o+S6m1CHzqMZZKSnORaZnXtjk3qyl4rYf5z6f8XkFpKdEoEO+ch+n/e264CPA W7Tw== 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=x+lMwsOA5igTui7DZ6kBh3YAl4UcBGgcd2WaOCaIFgE=; fh=TN+2kqXp9b81wtk8n2cbpXkL9UHQK/yJiMAKVC87+Tk=; b=LCpoUi12SGvRzTHMgB8i7+sZ2o/sw6qO9HOQAd8ifD3PgzwOaUPkurLQLcQLdxvoiQ MSlcacdX9q1iUQIKgCay6uPcnDF6sE+kimB8qq15EqF+IsOrIULcheTn0P3tKWm2pTl/ t4b4iu2VMEhVSDnBoVRokp1dFu6lWZgZ7RA/olr6dJMXXXRxqtRYBT/FO72oBtET0R+g xQFDa46BdvFs9P7v5ZQvUvPsLWJZihLnQBtJ/vWVKt3J6pORXroBqcU6MhfHzZuNylkX F2z3OrBKhLRqM7l2NkQgw6N+4aD0D7RyedvlipxNeSkzHrzgxasuqfHfgHQFgVIXgj5W lOPQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=qe5+TlSb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 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 howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id r4-20020aa79624000000b006ba82adb9a6si6888121pfg.323.2023.10.23.14.11.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Oct 2023 14:11:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=qe5+TlSb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 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 howler.vger.email (Postfix) with ESMTP id 9F21B809C643; Mon, 23 Oct 2023 14:11:08 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229499AbjJWVK5 (ORCPT + 99 others); Mon, 23 Oct 2023 17:10:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42152 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229657AbjJWVK4 (ORCPT ); Mon, 23 Oct 2023 17:10:56 -0400 Received: from mail-yb1-xb31.google.com (mail-yb1-xb31.google.com [IPv6:2607:f8b0:4864:20::b31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EFF55AF for ; Mon, 23 Oct 2023 14:10:53 -0700 (PDT) Received: by mail-yb1-xb31.google.com with SMTP id 3f1490d57ef6-d9b2ca542e5so3584730276.3 for ; Mon, 23 Oct 2023 14:10:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1698095453; x=1698700253; 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=x+lMwsOA5igTui7DZ6kBh3YAl4UcBGgcd2WaOCaIFgE=; b=qe5+TlSbcTzsIarZ0V3yOtdThqwGSmNVpwKABxo5FObZpMNpdlCPoFbzfppacc6l0I Q5pfpPAnZhIMfepA0rUqjbTSxCa/AM2fGlq6VmM5uxsZrNLidV392a4PRmKVberjZKMl qn55hqJmbuwrRc3OSNvXsqppJTF2PFhRrL35oJ1QQfzqPQQA5+5SeAl6lqzwDhmyPpw2 5l7MP5QlHtn3Nx9gi5/OitwOphURDGru8YD4eHRF/KPvtvtIvJc4W9F6+tyAXZtPvY/I V8l8YtX8ow3R8iHbvIAKNTTWb4f+cU+wiTEn99Wl04tQTkSxwnpF19ufsRkk8iuFaQBX DVhQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698095453; x=1698700253; 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=x+lMwsOA5igTui7DZ6kBh3YAl4UcBGgcd2WaOCaIFgE=; b=iz2d7tGkHpNcuvpoiFedt2S4OkRAdqyv/m4G/hK/N51v6KI0um1K+bmZo1jBal9KVs ZQVEPoAQL9EMsvAeiVDnI35xXOMi+PbYRxteZGfqByl4UAfJaMaPg4Qx5Jc7uNVvsDL8 Wy3mzlTDBNz1ULyZkwIRoNLI7OUg6OH5ePdkZgMLKAzkxUgOOcMUgbDEFS8dCFTyCd/x iab+ZuWUyJFv/nGQUnafyAwh8BtZTO7Syrq0Uhd+L1K4iT0nOfhnB1LSfqxSZIYlT8Ke qmDfVv+ABeQiyM1iFrHYLN1bUJWlXWu4i4MyBwzv356ziTDt3yhlFUPvg9AM8uiILVOU 7kZA== X-Gm-Message-State: AOJu0YxWvO7Gzaam9Ar6+Vu9zOSY4YxocWPd474LhpGtp4++5tts+4BS ozNBVMU3Hkz+r1+Owklj1uvMag== X-Received: by 2002:a25:97c3:0:b0:d9a:d184:8304 with SMTP id j3-20020a2597c3000000b00d9ad1848304mr9817584ybo.35.1698095453004; Mon, 23 Oct 2023 14:10:53 -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 16-20020a250910000000b00d749bc5b169sm2962754ybj.43.2023.10.23.14.10.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Oct 2023 14:10:52 -0700 (PDT) Date: Mon, 23 Oct 2023 14:10:38 -0700 (PDT) From: Hugh Dickins X-X-Sender: hugh@ripple.attlocal.net To: Zi Yan cc: Hugh Dickins , Andrew Morton , 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 , "Huang, Ying" , Nhat Pham , Yosry Ahmed , linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH v3 10/12] mempolicy: alloc_pages_mpol() for NUMA policy without vma In-Reply-To: <61FB8BFF-E3CB-4C99-8A6D-845A69E4E76F@nvidia.com> Message-ID: <8c933f5b-983e-a332-e410-6ee6872f839f@google.com> References: <74e34633-6060-f5e3-aee-7040d43f2e93@google.com> <1738368e-bac0-fd11-ed7f-b87142a939fe@google.com> <61FB8BFF-E3CB-4C99-8A6D-845A69E4E76F@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Spam-Status: No, score=-8.4 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.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 (howler.vger.email [0.0.0.0]); Mon, 23 Oct 2023 14:11:08 -0700 (PDT) On Mon, 23 Oct 2023, Zi Yan wrote: > On 19 Oct 2023, at 16:39, Hugh Dickins wrote: > > @@ -1170,6 +1170,15 @@ static struct folio *new_folio(struct folio *src, unsigned long start) > > break; > > } > > > > + /* > > + * __get_vma_policy() now expects a genuine non-NULL vma. Return NULL > > + * when the page can no longer be located in a vma: that is not ideal > > + * (migrate_pages() will give up early, presuming ENOMEM), but good > > + * enough to avoid a crash by syzkaller or concurrent holepunch. > > + */ > > + if (!vma) > > + return NULL; > > + > > How often would this happen? I just want to point out that ENOMEM can cause > src THPs or large folios to be split by migrate_pages(). The only case I know of it happening was when a file was mapped, then that file truncated (cutting out the source page) before migrate_pages(&pagelist) reached it - rather a syzbotty thing to do, not of great reallife concern. I won't assert that's the only way: I've a ghost of a memory of another way, that I can't quite resurface, from a long-ago version of queue_pages_range(). But in the end just didn't care enough about it, because this is really just to save a bisection point from crashing - the possibility goes away in the 11/12 commit which follows this one, which takes VMA out of it altogether. Hugh