From patchwork Sun Sep 26 16:12:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nadav Amit X-Patchwork-Id: 12518951 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2487CC433F5 for ; Sun, 26 Sep 2021 23:44:12 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id C964D61154 for ; Sun, 26 Sep 2021 23:44:11 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org C964D61154 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id CB3696B0081; Sun, 26 Sep 2021 19:44:06 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id BA04E900002; Sun, 26 Sep 2021 19:44:06 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id AB88A6B0083; Sun, 26 Sep 2021 19:44:06 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0046.hostedemail.com [216.40.44.46]) by kanga.kvack.org (Postfix) with ESMTP id 91E846B0081 for ; Sun, 26 Sep 2021 19:44:06 -0400 (EDT) Received: from smtpin24.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 404611802F645 for ; Sun, 26 Sep 2021 23:44:06 +0000 (UTC) X-FDA: 78631355292.24.F84B9BB Received: from mail-pf1-f178.google.com (mail-pf1-f178.google.com [209.85.210.178]) by imf13.hostedemail.com (Postfix) with ESMTP id 024E1103200C for ; Sun, 26 Sep 2021 23:44:05 +0000 (UTC) Received: by mail-pf1-f178.google.com with SMTP id w19so14099872pfn.12 for ; Sun, 26 Sep 2021 16:44:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=8K0wNqs/UoQMVWcbLzg7zpAq9uT/7eob5sdcWrFFCjE=; b=kFD/Z5J2xj2ugTXgq4UIoOmypwygBjvLHOo6K1Tc2eigh5LmmXmw4Zso7FtsJioTot NCveaxdSuE0wWDPtgXUB105caBHoki1Ykx3c6yGx1jzhRfbO6iVmun2NDokYZuBown1b jrDg1MmxL3N3x8JfVYUi5c5Bn9vT7lxFTM0DMbhZtblAQGV73y2w/ClWXvz/ykQVfJ/3 rp8weZtfpGoRSnQOOH2wRKK3bliUnB8OUuU/rYZR5mwQyzNYblNCGOLbyOlq1gl9Q6hB ApCFinCHC7VktDousGIAl5ap9EPULJ2GijlEFQ6okPzKb+v3evU1HXqnoQiYwu9pZqzA wLlA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=8K0wNqs/UoQMVWcbLzg7zpAq9uT/7eob5sdcWrFFCjE=; b=HyJpaKEBPInpc28LojppxxMCvMV5NoDeku/dvBbN/xXYs+xXnvuUPuuLC45dHfPYOQ sgRpBsuorpxkgNT3bgMvSuYKgO0T5bDRaP2y/dge/tHA3XEkS6BLMnN1rRjMURCDxpd5 5mJnFC1RFYR3xSgyJPz1oXEMdYOLIdV/AKGiT2TIZuVQ3SmRl7qoE3WxeWgmdnqMNGat uBJS3m3QggvJ1cOMPBP57raiupF14cWTUwyRL76L3Z7fFJ9/H0NcZcD7t8Lxzpbu5StV uB6wo0dMpCShrKohqUniOU1KZ9MG6ttyUgzAXIa16x1n9KB8o53ciX9GM1nHXB6X5ylm EmhA== X-Gm-Message-State: AOAM5336I8Vv+WMwVaMEaG49XRIz7y5jj72WDXjCXcwU2/qGOZ0AtJiC OiweXZpMQ0ddSJWlmmFnJEBg/fdcE+Y= X-Google-Smtp-Source: ABdhPJzac/DPGQPxntJXg+GNkdPOEat1QboVk7R+cPMmUqJpSRSm0/fyONTMqEx0qTMlguk/EPtXmQ== X-Received: by 2002:a65:6a4b:: with SMTP id o11mr13448662pgu.278.1632699844886; Sun, 26 Sep 2021 16:44:04 -0700 (PDT) Received: from sc2-haas01-esx0118.eng.vmware.com ([66.170.99.1]) by smtp.gmail.com with ESMTPSA id n22sm16783686pgc.55.2021.09.26.16.44.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 Sep 2021 16:44:04 -0700 (PDT) From: Nadav Amit X-Google-Original-From: Nadav Amit To: Andrew Morton Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Peter Xu , Nadav Amit , Andrea Arcangeli , Minchan Kim , Colin Cross , Suren Baghdasarya , Mike Rapoport Subject: [RFC PATCH 8/8] mm/madvise: process_madvise(MADV_DONTNEED) Date: Sun, 26 Sep 2021 09:12:59 -0700 Message-Id: <20210926161259.238054-9-namit@vmware.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210926161259.238054-1-namit@vmware.com> References: <20210926161259.238054-1-namit@vmware.com> MIME-Version: 1.0 X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 024E1103200C X-Stat-Signature: g6k857jnxoxahg4rbgjzcrzn8p9441sa Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b="kFD/Z5J2"; dmarc=pass (policy=none) header.from=gmail.com; spf=none (imf13.hostedemail.com: domain of mail-pf1-f178.google.com has no SPF policy when checking 209.85.210.178) smtp.helo=mail-pf1-f178.google.com X-HE-Tag: 1632699845-364985 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: From: Nadav Amit Userfaultfd users, for the sake of memory management, debugging or other types of monitoring may wish to use process_madvise(MADV_DONTNEED). Moreover, since process_madvise() supports vectored operations, and now supports efficient TLB flushes, existing users of madvise(MADV_DONTNEED) that wish to perform advices on non-contiguous memory may prefer the vectored process_madvise() flavor for performance reasons. Cc: Andrea Arcangeli Cc: Andrew Morton Cc: Minchan Kim Cc: Colin Cross Cc: Suren Baghdasarya Cc: Mike Rapoport Signed-off-by: Nadav Amit --- mm/madvise.c | 1 + 1 file changed, 1 insertion(+) diff --git a/mm/madvise.c b/mm/madvise.c index 9528c38fb6a4..d8f70960680e 100644 --- a/mm/madvise.c +++ b/mm/madvise.c @@ -81,6 +81,7 @@ static const struct madvise_info madvise_info[MADV_SOFT_OFFLINE+1] = { }, [MADV_DONTNEED] = { .behavior_valid = 1, + .process_behavior_valid = 1, .need_mmap_read_only = 1, .tlb_batching = 1, },