Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp585872rwb; Thu, 1 Dec 2022 06:06:40 -0800 (PST) X-Google-Smtp-Source: AA0mqf72NJBMDw4w0ig3VkE1AAm72bB2+i0ojAdJSlpFFvP151s7YnWhiEcbu8FZPfqO2cC9xDI2 X-Received: by 2002:a17:902:a60d:b0:189:65c4:ab5c with SMTP id u13-20020a170902a60d00b0018965c4ab5cmr33424976plq.5.1669903600580; Thu, 01 Dec 2022 06:06:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669903600; cv=none; d=google.com; s=arc-20160816; b=SgsUXQqYxaLRJeOBg+D4xNNqat3LhKM9gjotNLXcHDIvkPnpdqKEMYfTQhsJTBbTk4 xDHgK4DakyegJxbrzsMbAXY3ngxTR/JZJoiaHEJmxjqowALsKW7cFj3dOrz/BwF/CMlM 04OtHYlBspZjSNcjuhdIjToQWjFOt3ZdT76FS9wKryXO1TtLsX3OAuV0g9pxeBsGW6sO g9tnsYpHQcS+m+/fVDy1iTw+bjGmRDY7TRBMwdvYxHQUzrM+vC8j9r9XvA+xgK8bmGRW sWSlgfqtwdrQ/qZkWtnB5Y11iDWjEICOmo0J/0OtUAbcfAx2lhfDifdaoLaTSA883gvr n/cw== 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:content-language:references:cc:to:subject :user-agent:mime-version:date:message-id:dkim-signature; bh=YrLpv8IinAzI6TJvCdt8qSJlbjMH9iouKKI1hsHF2L4=; b=pBU1xFhbrCbGCr8Ay35J1NTZvz2qn63uX8xtP0gw0+2HoedzwX8AJhscN/TO5YfzS3 PPE9dt22wYHvbp3+56+uoPlvMBabXbmORBz/ED/fxbpkvEdmUANQrUZXLlyhr/cvYfef YyCNy9+1KwKsJvFz5kNYfGK1HkJJgUOZNrtDqmA2gSq1lc88CPRBBAY0E8oz0oSzK7Do rMIB23AcnI5LY6r4YCKst4ckq3YvrWxi0DWTMF1yT6Cmp/y9PsZp7BB7tHmW1ePKGPxh edAZAVn9h4ZyJUtYKdZMREGLCGvowMDsjDIjnpTy/+2PqD7wccK/Jwe4/R5M9GxCEUUx +htQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Lgd71gE0; 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=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x5-20020a654145000000b0047715878df9si4254192pgp.628.2022.12.01.06.06.23; Thu, 01 Dec 2022 06:06:40 -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=@redhat.com header.s=mimecast20190719 header.b=Lgd71gE0; 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=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231296AbiLANDB (ORCPT + 82 others); Thu, 1 Dec 2022 08:03:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42774 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231237AbiLANC3 (ORCPT ); Thu, 1 Dec 2022 08:02:29 -0500 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 EAC5C90779 for ; Thu, 1 Dec 2022 05:01:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1669899687; 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=YrLpv8IinAzI6TJvCdt8qSJlbjMH9iouKKI1hsHF2L4=; b=Lgd71gE0rB4yD5cfWb7iXfM6srFES8H4gacYXHKpipyXllHRH9Gn60P8k6NwZoPdsfoYm/ Wn7Ktdh9XSgBm0OfvyxVIgCvCtl61dz4E2B1MryZpZBWjeAkmz0896oWhyMSUFKL4fuisM Mbvy2jzFHytPCz004B2Rm+QlqPgHu9k= Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-591-ivJQ47baPm-1yKeNs1YWLQ-1; Thu, 01 Dec 2022 08:01:25 -0500 X-MC-Unique: ivJQ47baPm-1yKeNs1YWLQ-1 Received: by mail-wr1-f69.google.com with SMTP id y5-20020adfc7c5000000b002423fada7deso111917wrg.7 for ; Thu, 01 Dec 2022 05:01:25 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:organization:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=YrLpv8IinAzI6TJvCdt8qSJlbjMH9iouKKI1hsHF2L4=; b=oYuRSQrcHwyQzQkAKmyPIhew7vv29TUYMUfzkKZsWQ0UYGiYd5rCnKD2tGK/tgZPWB o0U3+t+VtY4SfWWY2IUQwMPLdPGV3C+MNIUQdezS3H5SPLzoju2V2ZCo/Ps2FLgmjqZC Om5pTJspZPeQGnfLMz9yzuRbC0rg7yIhDgi3sz3rlyWVHjVIX0bV6Uaow+N/KcXChm6B b+R8Es2nMsX09EdKJr0z7UjjuEM2DXHfwDToR1Mjg0r12sgPr+MJN2YOrdJGMTCMaW1z tk7cg1X9fV3vTVl30yKtvlacPeyE2temaw4aGdJK/Qtg/flyFwcgL7BBCtYdNRsZIB21 n8Fg== X-Gm-Message-State: ANoB5pkC/xlf/3KciDRi+u0ZX6+0unGmAIHWijibmUJ46XqZSuFRmkTc DFFgoRjB7hb0xIcPqE8Cuqn58TMLElFxlIbvJ0ZbJxhT+7Dodps6B7dyewTPhcRrciaJLMlOc5v QuUMcsbjTJF0Eos7eBcPevBW5 X-Received: by 2002:adf:f4cb:0:b0:242:3b56:cc79 with SMTP id h11-20020adff4cb000000b002423b56cc79mr1494428wrp.310.1669899684496; Thu, 01 Dec 2022 05:01:24 -0800 (PST) X-Received: by 2002:adf:f4cb:0:b0:242:3b56:cc79 with SMTP id h11-20020adff4cb000000b002423b56cc79mr1494394wrp.310.1669899684139; Thu, 01 Dec 2022 05:01:24 -0800 (PST) Received: from ?IPV6:2a09:80c0:192:0:5dac:bf3d:c41:c3e7? ([2a09:80c0:192:0:5dac:bf3d:c41:c3e7]) by smtp.gmail.com with ESMTPSA id d7-20020a056000114700b00242152e06f9sm4230517wrx.116.2022.12.01.05.01.23 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 01 Dec 2022 05:01:23 -0800 (PST) Message-ID: <906b0150-ef7c-d2b9-783f-4e94c48fa367@redhat.com> Date: Thu, 1 Dec 2022 14:01:22 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.5.0 Subject: Re: [PATCH] mm/madvise: fix madvise_pageout for private file mappings To: Pavankumar Kondeti , Andrew Morton Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Suren Baghdasaryan , Minchan Kim , Charan Teja Kalla , Prakash Gupta , Divyanand Rangu References: <1667971116-12900-1-git-send-email-quic_pkondeti@quicinc.com> Content-Language: en-US From: David Hildenbrand Organization: Red Hat In-Reply-To: <1667971116-12900-1-git-send-email-quic_pkondeti@quicinc.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE 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 > + * If the VMA belongs to a private file mapping, there can be private > + * dirty pages which can be paged out if even this process is neither > + * owner nor write capable of the file. Cache the file access check > + * here and use it later during page walk. > + */ > + can_pageout_file = can_do_file_pageout(vma); Why not move that into madvise_pageout_page_range() ? Avoids passing this variable to that function. In fact, why not even call that function directly instead of storing that in madvise_walk_private(). The function is extremely lightweight. > > lru_add_drain(); > tlb_gather_mmu(&tlb, mm); > - madvise_pageout_page_range(&tlb, vma, start_addr, end_addr); > + madvise_pageout_page_range(&tlb, vma, start_addr, end_addr, can_pageout_file); > tlb_finish_mmu(&tlb); > > return 0; -- Thanks, David / dhildenb