Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp2768734rdh; Sun, 26 Nov 2023 19:42:08 -0800 (PST) X-Google-Smtp-Source: AGHT+IEcgdexCPXiFGNHFeFEMEjk1w4JWiOa5J9k8d/nvYMZNnw0xumKZcYmAK1H2aR4x3b5730j X-Received: by 2002:a05:6a00:2296:b0:6cb:735c:67af with SMTP id f22-20020a056a00229600b006cb735c67afmr14229657pfe.0.1701056528222; Sun, 26 Nov 2023 19:42:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701056528; cv=none; d=google.com; s=arc-20160816; b=czG8L7DpMdlWd9nqT/98YWXBNpajU7/D+PJBIEwNajx4xoA07+KIL6+SxObfZmGgSJ uMd6bdLXm95b0pbRhV8khF5JWK+YCef8SoOYm0VhZFPhRCPnuixSmkeNuOk4qvfnCpoV uJscpoFIB8Zv077C57wrOzru/vWJ4RZQXu/6H6EloRMwyXaJSdYISbPzSdo2+PKVlsmG vnPMjon50HlqmGlea84xDfBKCYTM8NzJ4iuGBwKvWQEgMCvpPliZKTMb0OMuE2ZMev4n rr3ot8tQqLjFZTb3LF/mPXiF2e9/pLqpR8Tq/dJma4sAIJ3NRiPRNHt3EgVdGSbQEfZ7 uMOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=658rtDCoA3Do8XbxgxnIPu7n7tXNaahQrbL0g80hn0o=; fh=KHwt4msnaRwM9ZZSCGrtTDp/38NPVx5EoZA6OLxTh88=; b=xwgshJfrlmtgnRU4ILVmc37q4kFq0PhnzD/MHd7R3/hVfgy3ikcLACRrIG302P8N2/ AwgBSKdjVPiD3CktrMypfQBUCVDxa3tndurzGMrxgBN5kP/Jh5LXJmvm/O+XGLz6U3Ja awh6yKygBSgXf8w8LfRNWLMONc6spI5wLNV484NSEYIM6UjxLSNH9bfEnqA46IH7wMBT JRJMR/2gK3gSxVrn1kfd+onbVj+qQHgjeQWL04I98CslwiqcJN01zHuVB1lvR4VcURLd fuiRBw+8Z02C6rEdLgI3wL2GAlZPMn6Y9AnJCv4LQ9C/O6F9xDp9jVVzWi3KfaIWk+Rp zU2Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=BHCnBqrL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id m189-20020a6258c6000000b0068895dea43csi8365156pfb.78.2023.11.26.19.42.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 Nov 2023 19:42:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=BHCnBqrL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id 938068085985; Sun, 26 Nov 2023 19:42:05 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229514AbjK0Dlu (ORCPT + 99 others); Sun, 26 Nov 2023 22:41:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60194 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229472AbjK0Dlt (ORCPT ); Sun, 26 Nov 2023 22:41:49 -0500 Received: from mail-pg1-x52a.google.com (mail-pg1-x52a.google.com [IPv6:2607:f8b0:4864:20::52a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 56965122 for ; Sun, 26 Nov 2023 19:41:55 -0800 (PST) Received: by mail-pg1-x52a.google.com with SMTP id 41be03b00d2f7-5c1acc1fa98so3355891a12.0 for ; Sun, 26 Nov 2023 19:41:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701056515; x=1701661315; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=658rtDCoA3Do8XbxgxnIPu7n7tXNaahQrbL0g80hn0o=; b=BHCnBqrLRMrvG75zCAqXbE/c2yP3NrM7VIEntIMtlnD8zAWU/VyZCWT4AhwUUtFqCg OCGdq0e2MNTX1q3TG5ePNHK4Pdw4xm2BRnC2xT1L6dRp+Tma9eDZl8KIMHXn3bnGkcWL X6EO3Nf0y7cKocy9+6eQKqq+uN8x2BhVNwUXE6lSSehL1dttCnfgv2ztVvbf2WnAy6ui bewr5QtN+4uFcB+FR7phUoRToZYEW0352ySSv4knBcqvIKok2iVAak7bymtjWuoYghrY 6G7DapEz1GrB8Q2CjTfepIpdqVlLeGHWleA1fymvyuxYz1n9mczeL2Ka67e1Y5SDtSVL tcNA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701056515; x=1701661315; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=658rtDCoA3Do8XbxgxnIPu7n7tXNaahQrbL0g80hn0o=; b=qRzqeEV1l6VtKiWFAeK90UE4NlSz8k0deb7Um+3tJDVzemdV3gPEgeKu49zYs3AJiX N9Rn1CyqJenW73OLYi7R94rqGPHOKVOGPP8aOgplO0x9Yi304SyCpGwtBxx5PjiaIDgJ HNLfS3b+objTTVZtVRdQE2VTzMcligcd8F+9l8JZXMfJIIj6WsfksGzpuaPC3ZL7NST6 z96+/yJ0J8ddZQe79GZr9Xerir+s8u/DcB4ktczrF2JmXx67MfMIgtVYblaf6f+qYx+Y 1BwtDNYtsMGHKeY20Evlwv9KqDKl6IXfvV/iGJsTjvWA5MFVdC/vk4wj69FtyoqoH3qU tlmg== X-Gm-Message-State: AOJu0Yx4v+ZYDavJ+Nxfg94WUk1bUb22JlhOViVkFARRrSJTotQbexRQ Dp05G3G4UTfywf5u5Xfnfzo= X-Received: by 2002:a17:90b:118:b0:277:68c3:64b9 with SMTP id p24-20020a17090b011800b0027768c364b9mr18749555pjz.5.1701056514711; Sun, 26 Nov 2023 19:41:54 -0800 (PST) Received: from barry-desktop.hub ([2407:7000:8942:5500:a061:a5bd:f09d:c339]) by smtp.gmail.com with ESMTPSA id 25-20020a17090a035900b002775281b9easm7237424pjf.50.2023.11.26.19.41.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 Nov 2023 19:41:54 -0800 (PST) From: Barry Song <21cnbao@gmail.com> X-Google-Original-From: Barry Song To: ryan.roberts@arm.com Cc: akpm@linux-foundation.org, anshuman.khandual@arm.com, catalin.marinas@arm.com, david@redhat.com, fengwei.yin@intel.com, hughd@google.com, itaru.kitayama@gmail.com, jhubbard@nvidia.com, kirill.shutemov@linux.intel.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, mcgrof@kernel.org, rientjes@google.com, shy828301@gmail.com, vbabka@suse.cz, wangkefeng.wang@huawei.com, willy@infradead.org, ying.huang@intel.com, yuzhao@google.com, ziy@nvidia.com Subject: Re: [RESEND PATCH v7 04/10] mm: thp: Support allocation of anonymous small-sized THP Date: Mon, 27 Nov 2023 16:41:35 +1300 Message-Id: <20231127034135.6754-1-v-songbaohua@oppo.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231122162950.3854897-5-ryan.roberts@arm.com> References: <20231122162950.3854897-5-ryan.roberts@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, 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 pete.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 (pete.vger.email [0.0.0.0]); Sun, 26 Nov 2023 19:42:05 -0800 (PST) > + if ((nr_pages == 1 && vmf_pte_changed(vmf)) || > + (nr_pages > 1 && !pte_range_none(vmf->pte, nr_pages))) { > + for (i = 0; i < nr_pages; i++) > + update_mmu_tlb(vma, addr + PAGE_SIZE * i, vmf->pte + i); > goto release; > } Hi Ryan, what has stopped nr_pages == 1 from using !pte_range_none(vmf->pte, 1) directly, then the code can become, + if (!pte_range_none(vmf->pte, nr_pages)) { + for (i = 0; i < nr_pages; i++) + update_mmu_tlb(vma, addr + PAGE_SIZE * i, vmf->pte + i); goto release; } for both 1 and > 1 cases? Thanks Barry