Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp1134307rdh; Mon, 25 Sep 2023 04:30:38 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEhRCnVCZn7C9jlO6jjwwLmn25KPcv8EfNx3K6BRx7dfsewVfZiwyJwMj5B4GB3jmuUtKF5 X-Received: by 2002:a05:6a00:1a91:b0:68f:c078:b0b6 with SMTP id e17-20020a056a001a9100b0068fc078b0b6mr8647889pfv.10.1695641438366; Mon, 25 Sep 2023 04:30:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695641438; cv=none; d=google.com; s=arc-20160816; b=t+Ib/CHvhbzvxo666z3e2ZuX0oTw+S+kJKmc9SAMIND5NoZIcmtvtVhxLLPfCRvP+n +eaqNPey4lFVzDSg/DbbtWM5doNMxIZH/0fFOLAuc6+EDjgL/t3Kc4RCwy7AL+D2oipo ALZLn1+GvO/XVQXw8uaxlelUcj4zVUQ8eHkeqtokM/0Fd95QhM644Y6v2IXoy+jwUh58 vIbDfQFlE1XHwWkCBLzTLd/VwUnWmEhSqBhxz4XjpkArCm3fidMVT59eZpAiVKJMBGaN y5CJQnMUgR9FrKtL8mmCea55H/POgDg1Pyr42lR6e/zGW6Q3izPWNrPpcn/SASBI7WKn Mt3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :organization:from:references:cc:to:content-language:subject :user-agent:mime-version:date:message-id:dkim-signature; bh=Fcs7WDgaaor+yyoRDl34XzlrYWO5pL3qK+P9ELjfqAQ=; fh=GTSgG8S2vldK5nMu77jmklF640DVGk2HUqKA5WN+G4Y=; b=dc47rir4WjoMZYK2svAqj16apiGxsidUasrQIo6NrSUg/eU9ROOtR4oXc4sOX79apx 5z0cj8DObSHNpXTe0S76XSUXxhLeDKfaVfTvxaW3FamA1yTJ8e8jPX7QOhHLfDDIband wJOBywEjao4U12V1a1bseb0cFLzoB55liWVC3wrn0FJqmlMOfufE+sxbgTZCNe30DQ1S 89V1Lu5TB8TbNX02S2nSb17Zs4F2v0VoFibErWU9LE8pkcPbOJByxqA6hX1l8ScTdhCu z487dK0yKoWI9lkg08zQnPW/pPRnDihLIcANrWB1CKCurIJ1HELRJESf5wCICRytR2Ta 43Gw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=N3L4dxoJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id o31-20020a635d5f000000b00565cc12ee24si9494798pgm.874.2023.09.25.04.30.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Sep 2023 04:30:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=N3L4dxoJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id E7AB18068E30; Mon, 25 Sep 2023 00:19:53 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229652AbjIYHTp (ORCPT + 99 others); Mon, 25 Sep 2023 03:19:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60088 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229459AbjIYHTj (ORCPT ); Mon, 25 Sep 2023 03:19:39 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0ED47C0 for ; Mon, 25 Sep 2023 00:18:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1695626324; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Fcs7WDgaaor+yyoRDl34XzlrYWO5pL3qK+P9ELjfqAQ=; b=N3L4dxoJi9j6XQyltcV9Y/O0WIN5lRITku26agVWQlNQeo08oNiccMMy7Ny2sIUqTFLOPn FbH8ZUHwKbE/z7YxPSbOhuqwvAraZ423qyDuKEdHZhadefVils3pYpL/iirdSAp6lNxaQ/ vW6XhpwCWJvH1PvGhrq1fL/3QVgVM0w= Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-247-5kYqc4K-MNmzGW3f77vEWw-1; Mon, 25 Sep 2023 03:18:43 -0400 X-MC-Unique: 5kYqc4K-MNmzGW3f77vEWw-1 Received: by mail-wr1-f72.google.com with SMTP id ffacd0b85a97d-3200597bfc5so4170790f8f.2 for ; Mon, 25 Sep 2023 00:18:43 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695626322; x=1696231122; h=content-transfer-encoding:in-reply-to:organization:from:references :cc:to:content-language:subject:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Fcs7WDgaaor+yyoRDl34XzlrYWO5pL3qK+P9ELjfqAQ=; b=sKVpA6uaRKxtzLl9O3hKGAxWePhHNSgnigV/GKa79kg31WD4mWT6G2up20JwYaYWm6 stcvn+0zJ2QQRoHswjpL+VPrkm0SCev5MNZ0yhG2U6C2YssWLD61ukvqCMoX9bAX9BG7 k9TX520F9iMAbvYmhY5AZFbSSQLjOFA0QQ1NYqwopOkbtn6Eoj6Nu8GFdBQK57ONqasT DYaqfD/J1Thubafi2EKBEZoy2jxzK9jBcYkfdMMFXDkZ9UjD4fSipbToObIpfi58L8E+ HKdytIwo7DFKFGvtht1T18sK+6PC4h1SkXDu0gvfDqZr61/YTjhmoAR+xB9pR1eJYkvL KkIw== X-Gm-Message-State: AOJu0YxPzxSHR5Kx6biHQ+Tf6cAKWZsQXW7CNg3+SPaLR05qqQocuE+0 o1gWxPbdO3NAWRKe78/cN6oaMGblqJPgCwFMYHk/pAp/KY2qHpz2VXNj4+7Xfg6jn/JLJIHeg7t 0dDR71SBlrBmICEaq5GVsbB2IA/BxH7gB X-Received: by 2002:a05:6000:1042:b0:316:ee7f:f9bb with SMTP id c2-20020a056000104200b00316ee7ff9bbmr4957008wrx.65.1695626322200; Mon, 25 Sep 2023 00:18:42 -0700 (PDT) X-Received: by 2002:a05:6000:1042:b0:316:ee7f:f9bb with SMTP id c2-20020a056000104200b00316ee7ff9bbmr4956992wrx.65.1695626321798; Mon, 25 Sep 2023 00:18:41 -0700 (PDT) Received: from ?IPV6:2003:cb:c736:2800:494a:6093:9096:6ae1? (p200300cbc7362800494a609390966ae1.dip0.t-ipconnect.de. [2003:cb:c736:2800:494a:6093:9096:6ae1]) by smtp.gmail.com with ESMTPSA id p5-20020a5d4585000000b0031ad5470f89sm11001731wrq.18.2023.09.25.00.18.41 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 25 Sep 2023 00:18:41 -0700 (PDT) Message-ID: Date: Mon, 25 Sep 2023 09:18:40 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Subject: Re: [RFC PATCH 1/2] mm/khugepaged: Convert __collapse_huge_page_isolate() to use folios Content-Language: en-US To: "Vishal Moola (Oracle)" , linux-mm@kvack.org Cc: akpm@linux-foundation.org, linux-kernel@vger.kernel.org References: <20230922193639.10158-1-vishal.moola@gmail.com> <20230922193639.10158-2-vishal.moola@gmail.com> From: David Hildenbrand Organization: Red Hat In-Reply-To: <20230922193639.10158-2-vishal.moola@gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.3 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,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 morse.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 (morse.vger.email [0.0.0.0]); Mon, 25 Sep 2023 00:19:54 -0700 (PDT) On 22.09.23 21:36, Vishal Moola (Oracle) wrote: > This is in preparation for the removal of the khugepaged compound_pagelist. > > 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_area_struct *vma, > struct collapse_control *cc, > struct list_head *compound_pagelist) > { > - struct page *page = NULL; > + struct folio *folio = NULL; > pte_t *_pte; > int none_or_zero = 0, shared = 0, result = SCAN_FAIL, referenced = 0; > bool writable = false; > @@ -570,15 +570,15 @@ static int __collapse_huge_page_isolate(struct vm_area_struct *vma, > result = SCAN_PTE_UFFD_WP; > goto out; > } > - page = vm_normal_page(vma, address, pteval); > - if (unlikely(!page) || unlikely(is_zone_device_page(page))) { > + folio = vm_normal_folio(vma, address, pteval); > + if (unlikely(!folio) || unlikely(folio_is_zone_device(folio))) { > result = 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. -- Cheers, David / dhildenb