Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp5147132rdb; Tue, 12 Dec 2023 23:22:11 -0800 (PST) X-Google-Smtp-Source: AGHT+IF4i6aH5YfpSEINWJMk2Xy3wrLTJ7dpEnIcqWokgRnpPajhpRO2xhc5h38DdQgPIu811AxS X-Received: by 2002:a05:6e02:1b8d:b0:35d:5995:1d69 with SMTP id h13-20020a056e021b8d00b0035d59951d69mr11964064ili.46.1702452131102; Tue, 12 Dec 2023 23:22:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702452131; cv=none; d=google.com; s=arc-20160816; b=YRni/RYeE6qTTd5jR4ndxkod98ej1EsAAetF5SIJsNHzvHKcU+K77fuLi946sHugcO Ga7zjC0tIBiAwWXNeOkPoaNwvmWGvh0GGIVhwUkC7lBeQex7BkmQOPk7dSkifGvkXT5q pm3dHF/oSGYzig6FTUUh7ZncLo+7eUj1LgS7Ng2l/7WRZppiV67JxmA/Lyr38LsLO6ix 1jecgkWHP5fhfpIdfr1GPUteigfEk7DmcaYisxHkvNC0N2M4bQmsoxzzyr7ykoglPMKE jATCsjT1x0GP+JzFwhpUfKZMdqaWr1j2l7bLGf6QGsVrH+g8Bqeytd8vub97BxYU67yU KlOQ== 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=RBgfcgQyAM0ZH2e9t97pZtF0A7py8/HaZt62MojergQ=; fh=VdZFymx2W1JJJwNKZgHjeLR6mDiSFaRiR33A9dBsLZs=; b=MaiZmt9V1IgZl+VgrFAet6MhicHBgGfcOC7OaccJ5S/sKPl/5A1I7qEi7KCUrh0xYd yqWYLDL85MPyqgZoc5fjZI9sdbu9qsphIVTJceaAyuQZQzO0pqfNs4gfUEcbb0UMx3Gv ep7cZv/LijKEGuunDOjrrm/R2rcLCK7mFGJeUUmr2sLogLNPn4qjFlHL/sYmLBiwfTeW +pWwZy5hgqZItCvIkaudpofdEwz5IqDXqvCOARsDULbU2DlhvrB8z9JTaCosidHM4ozR AqR7Halmx8i4Smn+F5anfRlj2K5SLbvSwmysaWDJgxS8iTJM9FHPuYwPINHlwNewPEoq rv4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=arbT6q5v; 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=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id s15-20020a63214f000000b005c66af62bacsi9086862pgm.174.2023.12.12.23.22.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Dec 2023 23:22:11 -0800 (PST) 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=@linaro.org header.s=google header.b=arbT6q5v; 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=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 9BD0581168AD; Tue, 12 Dec 2023 23:22:08 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233149AbjLMHVx (ORCPT + 99 others); Wed, 13 Dec 2023 02:21:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52894 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233114AbjLMHVv (ORCPT ); Wed, 13 Dec 2023 02:21:51 -0500 Received: from mail-ej1-x62a.google.com (mail-ej1-x62a.google.com [IPv6:2a00:1450:4864:20::62a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2C75EAD for ; Tue, 12 Dec 2023 23:21:58 -0800 (PST) Received: by mail-ej1-x62a.google.com with SMTP id a640c23a62f3a-a1e2ded3d9fso788030066b.0 for ; Tue, 12 Dec 2023 23:21:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1702452116; x=1703056916; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=RBgfcgQyAM0ZH2e9t97pZtF0A7py8/HaZt62MojergQ=; b=arbT6q5vrNDXBX9LrY4NiSU0AR6ddqHb4CSe659wptvRD8FN0gjGe/ESmKs7A2+pE3 vTsaCfQyvU99aK77eV9owenEZmXYiOHuDwlzxkurYiLeWkxwne/yW+zecc6GN55Rb417 /QbW+Xv0EUyzqWkGO/DSDvs+y1siOiIuMbOaU38mKJN9Y/1TPvqUsNWxXvOI41hDVt0G SusO1m1/DT1CK5o/SEfis58gSK5/jq9daikM8WdAxbIV9/mmIwIBTBmT3PyJ84URrxVl MGVizE0UxI5ba9+OfYnSFAU3Vv24pfl0fYAgCcrmHyAYRN/IOtwaKKob4WfnZ+KEJh7E s8vA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702452116; x=1703056916; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=RBgfcgQyAM0ZH2e9t97pZtF0A7py8/HaZt62MojergQ=; b=RgHh1/cU73AgJMTsMYxm3DqkA01f/wK8PzPa2ZXjGRUP7SB+HSMUHvaIRvXSjyQwPS QcTHvQguVkZdo1zMXA021gm5Q3lmx4OwlLn7oHQxoC9EJH6iXYx3Z39y85JJ2fITXh6A d1QwDBEQvaj7LAx054K7ZNm6r1s2b4kJOXLYZpaQdFEAYeXGTFffLBnce8DTHrN5iVaE Fka1geVKD23LbxuUn+feaUKKnKv0XznWqVEeatOZY4RaaN50Fn8OWO03dwZS2cAoAM/F knBUNrb/y4aTabV71BXICpOEw8N+1cl34gNFKvKLYFaz4/iSdENdqRxNj3drFqnW5qeg eY9g== X-Gm-Message-State: AOJu0Yxh1OgKN8lBwr7Y30M11iLkqRRuWOSu6jIuH72oBCZWm7nGdiy8 +Avgl8gGeyKB4YSsq8cNwzW84g== X-Received: by 2002:a17:906:1359:b0:a04:a274:2a0a with SMTP id x25-20020a170906135900b00a04a2742a0amr4337206ejb.73.1702452116628; Tue, 12 Dec 2023 23:21:56 -0800 (PST) Received: from localhost (h3220.n1.ips.mtn.co.ug. [41.210.178.32]) by smtp.gmail.com with ESMTPSA id si10-20020a170906ceca00b00a1e377ea789sm7187848ejb.203.2023.12.12.23.21.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Dec 2023 23:21:56 -0800 (PST) Date: Wed, 13 Dec 2023 10:21:52 +0300 From: Dan Carpenter To: Ryan Roberts Cc: Andrew Morton , Matthew Wilcox , Yin Fengwei , David Hildenbrand , Yu Zhao , Catalin Marinas , Anshuman Khandual , Yang Shi , "Huang, Ying" , Zi Yan , Luis Chamberlain , Itaru Kitayama , "Kirill A. Shutemov" , John Hubbard , David Rientjes , Vlastimil Babka , Hugh Dickins , Kefeng Wang , Barry Song <21cnbao@gmail.com>, Alistair Popple , linux-mm@kvack.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v9 04/10] mm: thp: Support allocation of anonymous multi-size THP Message-ID: References: <20231207161211.2374093-1-ryan.roberts@arm.com> <20231207161211.2374093-5-ryan.roberts@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231207161211.2374093-5-ryan.roberts@arm.com> X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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]); Tue, 12 Dec 2023 23:22:08 -0800 (PST) On Thu, Dec 07, 2023 at 04:12:05PM +0000, Ryan Roberts wrote: > @@ -4176,10 +4260,15 @@ static vm_fault_t do_anonymous_page(struct vm_fault *vmf) > /* Allocate our own private page. */ > if (unlikely(anon_vma_prepare(vma))) > goto oom; > - folio = vma_alloc_zeroed_movable_folio(vma, vmf->address); > + folio = alloc_anon_folio(vmf); > + if (IS_ERR(folio)) > + return 0; > if (!folio) > goto oom; Returning zero is weird. I think it should be a vm_fault_t code. This mixing of error pointers and NULL is going to cause problems. Normally when we have a mix of error pointers and NULL then the NULL is not an error but instead means that the feature has been deliberately turned off. I'm unable to figure out what the meaning is here. It should return one or the other, or if it's a mix then add a giant comment explaining what they mean. regards, dan carpenter > > + nr_pages = folio_nr_pages(folio); > + addr = ALIGN_DOWN(vmf->address, nr_pages * PAGE_SIZE); > + > if (mem_cgroup_charge(folio, vma->vm_mm, GFP_KERNEL)) > goto oom_free_page; > folio_throttle_swaprate(folio, GFP_KERNEL);