Received: by 2002:a05:7412:251c:b0:e2:908c:2ebd with SMTP id w28csp1444710rda; Mon, 23 Oct 2023 12:49:22 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE6Uq5DlwYY8ElIF0y6xxatnZOETCe7OR/8ZQ+24Z20xncf7I3ydKxmUy9veMBSVySrkqhf X-Received: by 2002:a05:6a20:7da0:b0:16b:7fcb:4257 with SMTP id v32-20020a056a207da000b0016b7fcb4257mr671965pzj.4.1698090562579; Mon, 23 Oct 2023 12:49:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698090562; cv=none; d=google.com; s=arc-20160816; b=nOx2gUZcpRjRDVwKCUbApqFXGX9RyL6g1fMX5lHLGqcKWzcNEZwc0tptA49AkxypcB IIMKEUzki+itjQ/PnbL3xeS897z41q3fgoZyCS3kYBxfyu22CUoZFgNlTumL5r/2dPy6 LIQfSW3L1lGjPfr4WYQfV4GSDMJbFzE33b3Pv/I1ZFDkEKdLtmMA5+XrKqRieSGI24nW 4RWgoztUFG6ZMN1x7MVgeMzyTTkt5ba71xrWesteglyFTYp6C/5LopGVOq9SpG2FPx0C K/lAgmwNvw3D0qHb/2In+mYwu65KhM89RN7kEYF28wZdH54zmLbs9BbFXwfERvam92MJ YxOA== 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=wjX0MTPG3PvWqJGdMc/rfblXRp2Xo1J9VRn/MIM6Ez4=; fh=g/t4EwrVnqF2qkNt6V1wKJMVdXp0/UyxoKOZRBow304=; b=yN4YkjXRl66yJdO7ckoeYUNzz3fFBjqXpUVk4my44EFLGf0IIdwytQaDaHpdFbFDyK MZJdjlIRsgZs9lHxUfmzUvQppFXytM3JqU3eldpbGTN/KtEIi2o2HI+XIXby7ySeKbSV p1IA67hyWXB8Sbn4Ns6WuBKg/RUhjPByDQq8hnOv5+zNfBZLzNzoVG/nsug4R7hWV17O g7+75b1d5LAYi2MLaFCe6Ym9y5b5yMj1wA35FaI8TIabu6cA9qwwvd8cYX/jxivmbcFe BLGNPTFJVPflv5r3IMww7nsPjCXAKjIM6Hn1sojiEd8VrpPJZscIQhTWf+hGiZ7+8V4/ 0iXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=2+8Bl4x2; 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 co1-20020a17090afe8100b0027ce0950874si9426857pjb.127.2023.10.23.12.49.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Oct 2023 12:49:22 -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=2+8Bl4x2; 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 11A9A80A164B; Mon, 23 Oct 2023 12:49:20 -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 S229933AbjJWTs5 (ORCPT + 99 others); Mon, 23 Oct 2023 15:48:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44814 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231147AbjJWTsy (ORCPT ); Mon, 23 Oct 2023 15:48:54 -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 C32E6B4 for ; Mon, 23 Oct 2023 12:48:51 -0700 (PDT) Received: by mail-yw1-x112b.google.com with SMTP id 00721157ae682-5a7ad24b3aaso38622097b3.2 for ; Mon, 23 Oct 2023 12:48:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1698090531; x=1698695331; 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=wjX0MTPG3PvWqJGdMc/rfblXRp2Xo1J9VRn/MIM6Ez4=; b=2+8Bl4x2M7K50L3BMgxIEBOg9oImIq1RCIJaX+qbNMBJ0yxA3fafiaMC9IMReVUn3/ LTXZ2ycKvb6MRzenDTsp6hlUfo5KAvgC81vFc68f01zJ9unPr5c+oNlGpnWjBF1d9p1H hNc1NoJp2qDQfy9VaJKRH+qZo/OlToAa6RRkhqbk6+Tcu+HRtHR4dpIcJzxrsnzdKQ3h cSVvlTf+rlO5XvxgUm+xZk7esKbymOWpCug2niar3F753/d4rQpaELpTwG3k8vNa2khV KUqnYO3ctOCN3n/WiV4wlW6cYegFY4nMwJSfmX7iPaYb43ftNGeg/EnKRsEyuKlLx5FB w9bQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698090531; x=1698695331; 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=wjX0MTPG3PvWqJGdMc/rfblXRp2Xo1J9VRn/MIM6Ez4=; b=heDEFXwLfM3Jb2Hc7xmMdNwp8YzVYWy54YZPetJzkxIRI7ndI+jYSl4i89dx3ZcDPl 7y2tsNcs47wXTZCD0/pBvknTB/GAnfBG3gXO6+PIgBJYqkxpViLWJ0bDP1p07zMyLSzf FqsE9ADtHTXmOGWe5bjW6z2xgEisrecp3FFYD5whcfX4mzTgbWvmlV1tDqfdRuSii10B UbM0DxLSvnzZILokBm8N2ar9l5xlCFOVTblh9oJbX36WWeSnggNSfa943k1M1UX/dORh YJATWMCK9hyNOSllsfrb6bssGW3cFTzfEEGMLLw8XowVK1REBNOAxxOCN2b9ITt7/pxO Ds2g== X-Gm-Message-State: AOJu0YwawPTArw3H/aof+QRDVV+JGmPJQN+ztQF4mQjqn0fPyYiC+xe0 V9EBY9nOKepysC/2fKg0TLHp7w== X-Received: by 2002:a05:690c:f8d:b0:5a8:dbb1:f73b with SMTP id df13-20020a05690c0f8d00b005a8dbb1f73bmr11384273ywb.14.1698090530827; Mon, 23 Oct 2023 12:48:50 -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 d136-20020a814f8e000000b005a7d9fca87dsm3354999ywb.107.2023.10.23.12.48.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Oct 2023 12:48:49 -0700 (PDT) Date: Mon, 23 Oct 2023 12:48:38 -0700 (PDT) From: Hugh Dickins X-X-Sender: hugh@ripple.attlocal.net To: Johannes Weiner cc: domenico cerasuolo , Andrew Morton , Hugh Dickins , 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: <20231023190555.GA1964810@cmpxchg.org> Message-ID: <6b9b1256-f9ab-c418-ec7f-8fc74449cd68@google.com> References: <74e34633-6060-f5e3-aee-7040d43f2e93@google.com> <1738368e-bac0-fd11-ed7f-b87142a939fe@google.com> <20231023105331.311373ed33a0dfe78ddaa9e5@linux-foundation.org> <20231023190555.GA1964810@cmpxchg.org> 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 12:49:20 -0700 (PDT) On Mon, 23 Oct 2023, Johannes Weiner wrote: > On Mon, Oct 23, 2023 at 08:10:32PM +0200, domenico cerasuolo wrote: > > Il giorno lun 23 ott 2023 alle ore 19:53 Andrew Morton > > ha scritto: > > > > > > On Mon, 23 Oct 2023 18:53:26 +0200 domenico cerasuolo wrote: > > > > > > > > Rebased to mm.git's current mm-stable, to resolve with removal of > > > > > vma_policy() from include/linux/mempolicy.h, and temporary omission > > > > > of Nhat's ZSWAP mods from mm/swap_state.c: no other changes. > > > > > > > > Hi Hugh, > > > > > > > > not sure if it's the rebase, but I don't see an update to > > > > __read_swap_cache_async invocation in zswap.c at line 1078. Shouldn't we pass a > > > > mempolicy there too? > > > > > > No change needed. zswap_writeback_entry() was passing a NULL for arg > > > `vma' and it's now passing a NULL for arg `mpol'. Andrew's answer was indeed my thinking, and why none of us got a build error. > > > > Problem is that alloc_pages_mpol is dereferencing mpol, when I test the zswap > > writeback at 397148729f21edcf700ecb2a01749dbce955d09e it crashes, not sure if > > I'm missing something. > > I don't think you are. The NULL vma used to go to get_vma_policy(), > which fell back to > > pol = get_task_policy(current); > > Now the NULL pol gets passed to alloc_pages_mpol() directly, which > dereferences it. Oops. Yes, I failed to think it through that far. > > I think Hugh's patch needs zswap to pass get_task_policy(current) > instead of NULL. That sounds the likely fix, thank you Domenico, Andrew, Johannes. I'll check it out and send a fix patch later today. I don't know who runs that zswap_writeback_entry() code, but I presume that task's mempolicy is unlikely to be relevant to the swap cache page in question: but a whole lot better than oopsing, and will reproduce the previous behaviour (and the assumption at this writeback point would be that the page is unlikely to be reused after writeback anyway, so its node unimportant). Hugh