Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp1358597pxm; Thu, 3 Mar 2022 16:08:43 -0800 (PST) X-Google-Smtp-Source: ABdhPJw99q/A+6PgJf7kyi1huLUVcx9Yvjo3qnUi+ckksV68hGybZF+XHlNXtgcWKJaypZRBjVdy X-Received: by 2002:a05:6a00:2313:b0:4e0:ffa7:bbe0 with SMTP id h19-20020a056a00231300b004e0ffa7bbe0mr40507825pfh.53.1646352523621; Thu, 03 Mar 2022 16:08:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646352523; cv=none; d=google.com; s=arc-20160816; b=t9T55LanpWwrW7UGdl7nsF5daLm+0490ZDSjL72hUgwHNnE8q6J5/xSuKhMEbc5ImL /mFT6KQ4J+R7CNSFyP3nUliLLcWyjD9Qv6w/aKGYDhHV58oHnvabcsxpdl1xJlac2X5j ffYfCAyZ455OzJ7XF3+3iU2vvFxWWUFMNSBBuNt4Xeb9oq8AmWIEtTD+E5p93bW4ZjPa vusCFizjw7C4tl56yDo29ASESx1gKcDsNaQuY1GhiAUNKwN1M/P/VYC9QYRRJQEICG8/ jzpIIOp5xkpv2d4HUpISLdaok3TbsBkq5f3mK7pARA1MXBr+qEunMuoVZu9ftWF+kBlH aJkQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:references:message-id :content-transfer-encoding:cc:date:in-reply-to:from:subject :mime-version:dkim-signature; bh=mTTQbV2A2vstkO2kh5RQpGJLvdRtPFWdqW179J6hNJ0=; b=JdVSvqZuH8L8t7/1rQNlHbgEtqX//yp5axRmW8SSs/qECamav9R+S2aeZYMQEm5mKr r8ePrBcrvsVVC6HfUfhADn5KLO5OIScjJBGSUxFfdNCpB0dmL7/B/u6uRq+bL3lmtSi0 aNWHQbU4zzedMmPf8oUXFiRZlaMbLR093ua/UpKszq4hDEotmFzclfwkSTof7Gmy5AsA LCgZU0CzcdzU3uxb7PGBiaPH+ZtONDmo9rJTfTHTpA8WXR838iUHM4y9wMHAQ0y98cXL cjh+lOtPZU/XQ0sJWotizIr/RD8uHvyz+VQYer9K+4QeRAE8X/FuoTzDY9LFDgKJrsrY EN7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="N0Hu/qem"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s14-20020a17090aba0e00b001b90f330063si3183531pjr.175.2022.03.03.16.08.26; Thu, 03 Mar 2022 16:08:43 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="N0Hu/qem"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236571AbiCCVgq (ORCPT + 99 others); Thu, 3 Mar 2022 16:36:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42588 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236566AbiCCVgo (ORCPT ); Thu, 3 Mar 2022 16:36:44 -0500 Received: from mail-pl1-x631.google.com (mail-pl1-x631.google.com [IPv6:2607:f8b0:4864:20::631]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 27AC216FDD9 for ; Thu, 3 Mar 2022 13:35:59 -0800 (PST) Received: by mail-pl1-x631.google.com with SMTP id p17so5933834plo.9 for ; Thu, 03 Mar 2022 13:35:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=mTTQbV2A2vstkO2kh5RQpGJLvdRtPFWdqW179J6hNJ0=; b=N0Hu/qem+pyMDDz2i8akwdkI4o0ab5wiaqXHx0jVz8DekzDFJJGKCRQh9OzA8XMX+h gmZ1SbI4TvAiqXEdoRbtS21W9hIOgHzQKi2Dbvkfbf83YeFsb5H4IQswCLbgbo9P0wg0 Sb45Ip01tIdIB6zxEYBtv29Tf7VEYsuPCETkD5wrZt09QwMEXceBkvR3WAzUnfsQYp63 GWU0E/r+PovlZQjGUuQsjGLyAh6YJkuPB4XmvgitREtgMLbKEy6EVKB8CfEg9iIYi59E RLaHzAzuN7Cg5+vQznojiovQNSR3CrW8Xt6p0DJnY9XqFDx29JyvX1AWhJzBaqu1h+/c rQQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=mTTQbV2A2vstkO2kh5RQpGJLvdRtPFWdqW179J6hNJ0=; b=oDBzjxHPANXHSyLZSBIhbEgZ/uEKIExbfEX0s/3FhlJmb4SxhJrYbUmPXQBErOGe5h JSuyRhHpkDkZjR/TqIi67uzW9oF8JjaGx3VNuhg8uYAoCxMFoQzsr60oXrfpbOBZAjCR 3Ae5ZD2Roz4a0ZOpQ1x/4PAqYJ0aeQQiaqdRTf3zBLCMrkui+7YU+LQ8K/4UiW9wB/YP IhAvHQXfuP0IpMLdNbFVd5GrUtNhbdSwc2iNtbktnYAlEgMOFoK2wNohShyadsnPptzy N4s3BcK4dxNa1TpYK/46rodarxgt1cLuJ2KAPiKe4wPOl6luXXBwVVsu8hyODeBAsOm1 H07w== X-Gm-Message-State: AOAM531X2KWE+JBMcjt9gEK3nC+wrZu++kZvANr9iPyOG9qAoqz199c7 cCr+XTfw5NtUkbfyRkzGBwnXoxNc05g= X-Received: by 2002:a17:902:7b8d:b0:14f:1aca:d95e with SMTP id w13-20020a1709027b8d00b0014f1acad95emr37928815pll.122.1646343358520; Thu, 03 Mar 2022 13:35:58 -0800 (PST) Received: from smtpclient.apple ([66.170.99.1]) by smtp.gmail.com with ESMTPSA id lr11-20020a17090b4b8b00b001bc4098fa78sm3115724pjb.24.2022.03.03.13.35.57 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 03 Mar 2022 13:35:58 -0800 (PST) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 15.0 \(3693.60.0.1.1\)) Subject: Re: [PATCH] mm: madvise: MADV_DONTNEED_LOCKED From: Nadav Amit In-Reply-To: <20220303212956.229409-1-hannes@cmpxchg.org> Date: Thu, 3 Mar 2022 13:35:56 -0800 Cc: Andrew Morton , Michal Hocko , Vlastimil Babka , Linux-MM , linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Message-Id: References: <20220303212956.229409-1-hannes@cmpxchg.org> To: Johannes Weiner X-Mailer: Apple Mail (2.3693.60.0.1.1) X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > On Mar 3, 2022, at 1:29 PM, Johannes Weiner = wrote: >=20 > MADV_DONTNEED historically rejects mlocked ranges, but with > MLOCK_ONFAULT and MCL_ONFAULT allowing to mlock without populating, > there are valid use cases for depopulating locked ranges as well. ... > @@ -850,7 +858,7 @@ static long madvise_dontneed_free(struct = vm_area_struct *vma, > VM_WARN_ON(start >=3D end); > } >=20 > - if (behavior =3D=3D MADV_DONTNEED) > + if (behavior =3D=3D MADV_DONTNEED || behavior =3D=3D = MADV_DONTNEED_LOCKED) > return madvise_dontneed_single_vma(vma, start, end); > else if (behavior =3D=3D MADV_FREE) > return madvise_free_single_vma(vma, start, end); > @@ -988,6 +996,7 @@ static int madvise_vma_behavior(struct = vm_area_struct *vma, > return madvise_pageout(vma, prev, start, end); > case MADV_FREE: > case MADV_DONTNEED: > + case MADV_DONTNEED_LOCKED: > return madvise_dontneed_free(vma, prev, start, end, = behavior); > case MADV_POPULATE_READ: > case MADV_POPULATE_WRITE: > @@ -1113,6 +1122,7 @@ madvise_behavior_valid(int behavior) > case MADV_REMOVE: > case MADV_WILLNEED: > case MADV_DONTNEED: > + case MADV_DONTNEED_LOCKED: > case MADV_FREE: > case MADV_COLD: > case MADV_PAGEOUT: Don=E2=80=99t you want to change madvise_need_mmap_write() as well and = add MADV_DONTNEED_LOCKED there too?