Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp3900107rdh; Tue, 28 Nov 2023 06:52:22 -0800 (PST) X-Google-Smtp-Source: AGHT+IHDODTJgpk1KXgfPbIIPEkteeEUEF8j8/8fWI5KxQPJJq5T9aZjDsrcXGvIOCO2uSUHzMaF X-Received: by 2002:a17:902:db0d:b0:1cf:cc0d:9600 with SMTP id m13-20020a170902db0d00b001cfcc0d9600mr8584291plx.24.1701183142184; Tue, 28 Nov 2023 06:52:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701183142; cv=none; d=google.com; s=arc-20160816; b=X1OhQWEfXaS36b/BgynFSqiQ4ECAPo7uDP6axde6CsRO13uRorO7YLMN6mL/VloAqU VRB2NNNJ6GvA6J9IcTk9nvgbI/xy95n0G82y06CB+0JhEMsBb87PPgJd/rOiMfls18Su 51BfE2DKPS5hgGlY2F01sDZAlhJYeydIzlasPUNW8+NeQBC+qhdRDXJHnIX+0w70dmZm HVVMRAj8mcd2SapJqT+s3+dXPPdT0L7FwTObE/J0M2tjdDcLQhT9AUk7Lr1QzpFDTdtP U951lSiFhkL9JAfUZ9x8SGqNx5gpkKOfRd2cnrDgUEJMqLImd8ToMcSartMdzaVE5LgC sHjA== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=67STPsy6Yttu5OTEOdQdes0zyFL6yGDHY2kQG1seqTc=; fh=iXyIHEqHOYLHaHkg4AmQBb0b8vPARyWexIbS110BxH8=; b=nNHzUu+jDwVq84NJd/wMCWNbVHsUv4ikWO1cPHu2uH9Fl6YmfECieDwjlKuh6K7rbf 938FxdY4C4dK6r27oZNoUTJq233W5H3VT+FpVl27zFFkznDD30Z32S8jAZz0FHOCTVj2 Kmm/or+vbqrOkDjm8qaphfecQGSqqwBRwBzCR/ZC8gDFTD+9BmuRUO0E/B7oX4L1Crx2 8BMsYnMzUbD1qmS6cd8n+46jekO7VMpt5RoLxas893f44NItujXct9NmWLeYQ0d62obN rXUzX6Rif0TvCRfM8NYFbEUAm04V7fIFlfieaWi8UdEl8e4rqZYzqqeivhGVowK5KYob +d3A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=dnWiF7tH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 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 agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id x4-20020a170902820400b001ce078b233fsi11551977pln.609.2023.11.28.06.52.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Nov 2023 06:52:22 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=dnWiF7tH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 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 agentk.vger.email (Postfix) with ESMTP id 7A6B980A4438; Tue, 28 Nov 2023 06:52:19 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346364AbjK1OwF (ORCPT + 99 others); Tue, 28 Nov 2023 09:52:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35374 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346347AbjK1OwE (ORCPT ); Tue, 28 Nov 2023 09:52:04 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6844BD5D for ; Tue, 28 Nov 2023 06:52:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1701183130; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=67STPsy6Yttu5OTEOdQdes0zyFL6yGDHY2kQG1seqTc=; b=dnWiF7tHh3T1y4v5o6v4IOZOBwIRZvKsGcIIo5O4s5jmHtLuiO23fX4uyDPstw/yIeciht meEUggFawqZMWpVLPIqOoHNZ53oYZwREtCg8ygwPYZU9oYbD4zWXtZjCRt5hpK5dlxXQ72 K6Cog+d37m97tYCDqEkyaGS0lqUnzQA= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-694-XDuPIX5MMNWkPMG8m_m4UQ-1; Tue, 28 Nov 2023 09:52:07 -0500 X-MC-Unique: XDuPIX5MMNWkPMG8m_m4UQ-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id DEC1680D730; Tue, 28 Nov 2023 14:52:06 +0000 (UTC) Received: from t14s.fritz.box (unknown [10.39.193.189]) by smtp.corp.redhat.com (Postfix) with ESMTP id D3DE75028; Tue, 28 Nov 2023 14:52:05 +0000 (UTC) From: David Hildenbrand To: linux-kernel@vger.kernel.org Cc: linux-mm@kvack.org, David Hildenbrand , Andrew Morton , Mike Kravetz , Muchun Song Subject: [PATCH v1 0/5] mm/rmap: separate hugetlb rmap handling Date: Tue, 28 Nov 2023 15:52:00 +0100 Message-ID: <20231128145205.215026-1-david@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.5 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,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 agentk.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 (agentk.vger.email [0.0.0.0]); Tue, 28 Nov 2023 06:52:19 -0800 (PST) Let's just cleanly separate hugetlb rmap handling from "ordinary" rmap handling, like we already do when adding anon hugetlb folios. We have hugetlb special-casing/checks in the callers in all cases either way already in place: it doesn't make too much sense to call generic-looking functions that end up doing hugetlb specific things from hugetlb special-cases. This now also means that we won't run into "folio_test_pmd_mappable()" cases for hugetlb, which doesn't make too much sense with gigantic hugetlb folios that are in fact currently only PUD-mappable. Or having a folio_add_file_rmap() function that looks like it clould be used by hugetlb code, but really can't. This is a stanalone cleanup, but it gets more relevant when adding more rmap batching (we cannot map parts of a hugetlb folio) or changing the way we handle partially-mappable folios as in [1], whereby we'd have to add more hugetlb special casing to keep hugetlb working as is. If ever something about hugetlb changes that makes them actually partially-mappable folios, we can look into cleanly merging all code paths, not just some. [1] https://lkml.kernel.org/r/20231124132626.235350-1-david@redhat.com Cc: Andrew Morton Cc: Mike Kravetz Cc: Muchun Song David Hildenbrand (5): mm/rmap: rename hugepage_add* to hugetlb_add* mm/rmap: introduce and use hugetlb_remove_rmap() mm/rmap: introduce and use hugetlb_add_file_rmap() mm/rmap: introduce and use hugetlb_try_dup_anon_rmap() mm/rmap: add hugetlb sanity checks include/linux/mm.h | 12 +++++++++--- include/linux/rmap.h | 37 +++++++++++++++++++++++++++++++++++-- mm/hugetlb.c | 21 ++++++++++----------- mm/migrate.c | 6 +++--- mm/rmap.c | 31 ++++++++++++++++++------------- 5 files changed, 75 insertions(+), 32 deletions(-) base-commit: b85ea95d086471afb4ad062012a4d73cd328fa86 -- 2.41.0