Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp1483932rdh; Mon, 25 Sep 2023 14:24:27 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEw0Yz5hXnt9pGgVPnMJhhd6iUQ+TF7FAvnaGt5309n+47C0vJO038kdwJAR4UW/hM6G8kC X-Received: by 2002:a17:903:246:b0:1c1:fe97:bf34 with SMTP id j6-20020a170903024600b001c1fe97bf34mr7111601plh.24.1695677066676; Mon, 25 Sep 2023 14:24:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695677066; cv=none; d=google.com; s=arc-20160816; b=Blge2zq5i58Vz4wZYHC8zh40KxainW+Rfm1Le2vgrQq1SiZoQWkhkO7TrWDF64CO/U w6ZTqDk1LFSSDEatEyOs+ittfIdBWcSuOCyHtPocQp1BLomAoICyDVf1YGeb/PtrRoQf uI2F5B/f+NAdQJr8g3vigIkd4L361fIqUIFnXGoHArtnuXMqKuMd6rKQPPyqeqaOZJsS z7p+5csCwHhX7OV6wOdXL880U0Urdom9izH7tBwZ5t7Jc2X3L5ngP/Nf78Gfu8+Z8IGo HLtf+bzdkk11rrgNfjNWP2wzJZbK9RMKgMrZeNYswjHhjJthMeepRE1Q7q66EhBQ4ipx 9X1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=HuoynwRV5c5Nr3xHW2kpZ/cwqzPNC7pXTPcMuN6SgkI=; fh=TY8UmoYVQgZDhKFN0Lf6BMx1K5Ipit+3mm+RFX9dRO4=; b=toNGFx40ejRZdoOW16CpLSxd2cj3yMZf3CJ8Flx01bbeJEIHP3k9u7IU8nXnLdZDbr 0OsBzuOUplXYiBzcuGp4uSmHDQCKIzLk2Uwg6mFwtdG7VayUObOu4px5P99MmTFc1awj lFdZybxOo60D8xR9Hv6cSxAvwnr55uUlJofT3JJNFYY6O946PpfLig49zpD8Cn4+a+OF dVhFdE8/WlDMF+E1NU5FZoBhrEnGFvL6t1C5i5QQUw8T4AbLUGAMzuyiIIR1ZE0K6S5W 02VRc0iko56X7wKferT+D2wAJHEcgFygRbRZRrIDJjqdxTRkT8slPI4gZdtBakuDMiJU p0nQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=Ktr1KBiR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 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. [23.128.96.36]) by mx.google.com with ESMTPS id kf16-20020a17090305d000b001b02e8d8976si10134062plb.300.2023.09.25.14.24.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Sep 2023 14:24:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) client-ip=23.128.96.36; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=Ktr1KBiR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 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 AE463802371B; Mon, 25 Sep 2023 11:58:19 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233280AbjIYS6K (ORCPT + 99 others); Mon, 25 Sep 2023 14:58:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51034 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232126AbjIYS6J (ORCPT ); Mon, 25 Sep 2023 14:58:09 -0400 Received: from mail-yb1-xb2d.google.com (mail-yb1-xb2d.google.com [IPv6:2607:f8b0:4864:20::b2d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 12D23B3 for ; Mon, 25 Sep 2023 11:58:03 -0700 (PDT) Received: by mail-yb1-xb2d.google.com with SMTP id 3f1490d57ef6-d86574d9bcaso5538737276.2 for ; Mon, 25 Sep 2023 11:58:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1695668282; x=1696273082; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=HuoynwRV5c5Nr3xHW2kpZ/cwqzPNC7pXTPcMuN6SgkI=; b=Ktr1KBiRoUJ2hMcCkcy60oxvgc1W9g/UQAaJZRCV/4U5uALnrI7IrQFydJOdS/iwj5 3/845Gm7vnOE5aKIOrmbEVwEUHV3HfsYPNO+ymeIVYiKneoO1IK3p+LOzVV0N0QdGLmH HUv835sCfwIP1A2yUiOdLj9ghcMWaODRTTtGVlnn7dBcS1sVFQ409TBuViRSaSwUUoDk vm+iGkK8HWpGEJ5Ov4R21i/+8vawpOYdTWV1ABFeIaZifaP5U2j4JeU+kyjaAyDe0jTU 4ETuWWXqFi1U/6IlGquDXDefDRSK2JCVePt6AYK20N3nM0wsT5+wss0WRhGS4jjY3/Aj X70g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695668282; x=1696273082; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=HuoynwRV5c5Nr3xHW2kpZ/cwqzPNC7pXTPcMuN6SgkI=; b=h+KflvlmIVjUMJt6uubgcEmmHD8y8KQlyqzI5OhETdVHpKE26gwXpHmGWDEAsf6U9+ FqaZSAT3YXoG3S0IM2D7PJNq+4jANcUh/uL3PXy93D93TowrXFs43qhO5SSAbP4YJn5s KL/MqHjNyYTIj9UQ0lOqsvvmlKVXgJjKmuhblsDQfsCp6qZ3duj6x75w0j1qTeM2UaH7 ZXlwFCehnQX8Ty1aNtL15CHD488Depup//U9ntbf2VV5DTrHCUuAykbVrft9irZv5rTO /wtKUKd4SnLO6s3N8jWneCmuOtOcOGSFOG97bDm6XNuIt6aFRbX0z4t51Y9djUnDApyg lqbg== X-Gm-Message-State: AOJu0YyWPwyO4yQPAyqI0QJ+ueNG8wPQ3pVsmiBaguSrwSGlbfnCtrvG 6RqzTKSeVxtTBEKWPoyn7JuV1E4sCNII7yMHrTs= X-Received: by 2002:a25:7455:0:b0:d85:3b6a:c3b8 with SMTP id p82-20020a257455000000b00d853b6ac3b8mr6880934ybc.45.1695668282213; Mon, 25 Sep 2023 11:58:02 -0700 (PDT) MIME-Version: 1.0 References: <20230922193639.10158-1-vishal.moola@gmail.com> <20230922193639.10158-2-vishal.moola@gmail.com> In-Reply-To: From: Vishal Moola Date: Mon, 25 Sep 2023 11:57:51 -0700 Message-ID: Subject: Re: [RFC PATCH 1/2] mm/khugepaged: Convert __collapse_huge_page_isolate() to use folios To: David Hildenbrand Cc: linux-mm@kvack.org, akpm@linux-foundation.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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 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]); Mon, 25 Sep 2023 11:58:19 -0700 (PDT) On Mon, Sep 25, 2023 at 12:18=E2=80=AFAM David Hildenbrand wrote: > > On 22.09.23 21:36, Vishal Moola (Oracle) wrote: > > This is in preparation for the removal of the khugepaged compound_pagel= ist. > > > > Replaces 11 calls to compound_head() with 1, and removes 499 bytes of > > kernel text. > > > > Signed-off-by: Vishal Moola (Oracle) > > --- > > mm/khugepaged.c | 52 ++++++++++++++++++++++++------------------------= - > > 1 file changed, 26 insertions(+), 26 deletions(-) > > > > diff --git a/mm/khugepaged.c b/mm/khugepaged.c > > index 88433cc25d8a..f46a7a7c489f 100644 > > --- a/mm/khugepaged.c > > +++ b/mm/khugepaged.c > > @@ -541,7 +541,7 @@ static int __collapse_huge_page_isolate(struct vm_a= rea_struct *vma, > > struct collapse_control *cc, > > struct list_head *compound_pageli= st) > > { > > - struct page *page =3D NULL; > > + struct folio *folio =3D NULL; > > pte_t *_pte; > > int none_or_zero =3D 0, shared =3D 0, result =3D SCAN_FAIL, refer= enced =3D 0; > > bool writable =3D false; > > @@ -570,15 +570,15 @@ static int __collapse_huge_page_isolate(struct vm= _area_struct *vma, > > result =3D SCAN_PTE_UFFD_WP; > > goto out; > > } > > - page =3D vm_normal_page(vma, address, pteval); > > - if (unlikely(!page) || unlikely(is_zone_device_page(page)= )) { > > + folio =3D vm_normal_folio(vma, address, pteval); > > + if (unlikely(!folio) || unlikely(folio_is_zone_device(fol= io))) { > > result =3D SCAN_PAGE_NULL; > > goto out; > > } > > > > - VM_BUG_ON_PAGE(!PageAnon(page), page); > > + VM_BUG_ON_FOLIO(!folio_test_anon(folio), folio); > > > > - if (page_mapcount(page) > 1) { > > + if (folio_estimated_sharers(folio) > 1) { > > For a tail page of a PTE-mapped THP this is not the same. > > The possible side effects this might have should be spelled out in the > patch description. Ok, I'll add the side effects to the commit message in v2.