From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.3 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A7470C4338F for ; Sun, 1 Aug 2021 23:12:54 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 26806610A1 for ; Sun, 1 Aug 2021 23:12:54 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 26806610A1 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 8549E6B0033; Sun, 1 Aug 2021 19:12:53 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 803668D0001; Sun, 1 Aug 2021 19:12:53 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6F1C06B005D; Sun, 1 Aug 2021 19:12:53 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0096.hostedemail.com [216.40.44.96]) by kanga.kvack.org (Postfix) with ESMTP id 524C16B0033 for ; Sun, 1 Aug 2021 19:12:53 -0400 (EDT) Received: from smtpin02.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id C6CDF8249980 for ; Sun, 1 Aug 2021 23:12:52 +0000 (UTC) X-FDA: 78428063784.02.0A1AC03 Received: from mail-pl1-f169.google.com (mail-pl1-f169.google.com [209.85.214.169]) by imf06.hostedemail.com (Postfix) with ESMTP id 7875F801AB23 for ; Sun, 1 Aug 2021 23:12:52 +0000 (UTC) Received: by mail-pl1-f169.google.com with SMTP id z3so16210095plg.8 for ; Sun, 01 Aug 2021 16:12:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=IHYj2rikYBVPR1AnfbpEYOnfHEiY6M+Z/Yv6hUYWiYw=; b=pP+jd7pno7a/FHKLtzA4tTfY6C9lSutvqYTbX05d9b9vLj5+DzQZmAGfsbII12eiEu te9N4ZsfEwPDW/p2X/j3NmEgXTAtSbvvLRO8STp/S6HibGwXgMWWNShzGxUHm6ZN7JOv OnF7muihY07NhmnGiv8l67GS22mcTOlQD6PVPohYlWPB+f6e38mg8qFJgxgpt18d27q1 jZVzWQXPYBUpHDTFHlvGjGw/eUt81NVQTfvZRiK2BfBTxKyBrfNTBmHZOOsoxpBrfOhi BOEtCU7xuLBpNO2ZK7tyqslKZ8XPoaSeIpUUrbj7CcEtTOhYNN7YUYOLPoiN7ZLDMf4o cRjQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=IHYj2rikYBVPR1AnfbpEYOnfHEiY6M+Z/Yv6hUYWiYw=; b=k0w5MzCtWjSqkj86BYgu/7zVDntAUdrI1Obnh2Tfn7PJfGkFk43OvaMOp7F2E1xlh8 sJTXnQOgopOIgPyZ2he4J5peFUi7bBNGKnIfqLz8xTbJXOA0hEA0BQw5TpS8wl58GY9U 4JgEZsyRoCSb3Ixxgq5BXc6yd0yy20f7w6RbA2IvdopOQPxdM9MB61knt800h7+fpEJc wqlp1u7LNTidtbsCyqlSRapMy9+vN8H+/xDCYeosBEfJ8XABOftoili1PHLVBjbHRqo3 x75UAJGQEylH+9ywAJTdJh/YQRVmssWnJwWkgsZLyZR8BHdf/xaBhDU1YgTItAadZq0v XRbQ== X-Gm-Message-State: AOAM5305ARtNyyiNThbAtJ+VQ5RFci8MvkXVDkWCllFH8C/3Kic1+l8D 0shgvlfqbgzoesXAXV8wA8YuZMibTM6LWzvN7kR8Ig== X-Google-Smtp-Source: ABdhPJx0Xwqam4KlfVojLpYxy9rIzxCZX3GJfhDDIs1AVZrY0/knostamF5zhtfhHHlvzvTlLk8nPWTZ9BJwWwYr5JQ= X-Received: by 2002:a17:90a:9b03:: with SMTP id f3mr13869141pjp.184.1627859570946; Sun, 01 Aug 2021 16:12:50 -0700 (PDT) MIME-Version: 1.0 References: <20210730221522.524256-1-almasrymina@google.com> <20210801124917.ca6fce3972866dc738bfcb7b@linux-foundation.org> In-Reply-To: <20210801124917.ca6fce3972866dc738bfcb7b@linux-foundation.org> From: Mina Almasry Date: Sun, 1 Aug 2021 16:12:39 -0700 Message-ID: Subject: Re: [PATCH v1] mm, hugepages: add mremap() support for hugepage backed vma To: Andrew Morton Cc: Ken Chen , Mike Kravetz , Linux-MM , open list , Chris Kennelly Content-Type: text/plain; charset="UTF-8" Authentication-Results: imf06.hostedemail.com; dkim=pass header.d=google.com header.s=20161025 header.b=pP+jd7pn; spf=pass (imf06.hostedemail.com: domain of almasrymina@google.com designates 209.85.214.169 as permitted sender) smtp.mailfrom=almasrymina@google.com; dmarc=pass (policy=reject) header.from=google.com X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 7875F801AB23 X-Stat-Signature: j9r368kjm4snywjtxckqz5u1z7odre7q X-HE-Tag: 1627859572-886538 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000014, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Sun, Aug 1, 2021, 12:49 PM Andrew Morton wrote: > > On Fri, 30 Jul 2021 15:15:22 -0700 Mina Almasry wrote: > > > Support mremap() for hugepage backed vma segment by simply repositioning > > page table entries. The page table entries are repositioned to the new > > virtual address on mremap(). > > > > Hugetlb mremap() support is of course generic; my motivating use case > > is a library (hugepage_text), which reloads the ELF text of executables > > in hugepages. This significantly increases the execution performance of > > said executables. > > > > Restricts the mremap operation on hugepages to up to the size of the > > original mapping as the underlying hugetlb reservation is not yet > > capable of handling remapping to a larger size. > > > > Tested with a simple mmap/mremap test case, roughly: > > > > void* haddr = mmap(NULL, size, PROT_READ | PROT_WRITE | PROT_EXEC, > > MAP_ANONYMOUS | MAP_SHARED, -1, 0); > > > > void* taddr = mmap(NULL, size, PROT_NONE, > > MAP_HUGETLB | MAP_ANONYMOUS | MAP_SHARED, -1, 0); > > > > void* raddr = mremap(haddr, size, size, MREMAP_MAYMOVE | MREMAP_FIXED, taddr); > > Could we please get testing for this added into tools/testing/selftests/? Yep sure thing. I'll wait some time to see if there are any other review comments and then send v2 with tests.