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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8B554C43217 for ; Thu, 1 Dec 2022 13:01:58 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id CD9E36B0072; Thu, 1 Dec 2022 08:01:57 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id C89A56B0073; Thu, 1 Dec 2022 08:01:57 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B29856B0074; Thu, 1 Dec 2022 08:01:57 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id A16D46B0072 for ; Thu, 1 Dec 2022 08:01:57 -0500 (EST) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 466381A0BA6 for ; Thu, 1 Dec 2022 13:01:57 +0000 (UTC) X-FDA: 80193749874.09.836CF4B Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf09.hostedemail.com (Postfix) with ESMTP id CF684140035 for ; Thu, 1 Dec 2022 13:01:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1669899693; 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=gGW7H99D/LB3n0ZZe/BRdMsefJmC3iSgA+/RNeh2+Uvq3Fk1/JdbMcHKkRYHq4zn1yt3Jl /cvMncYJGcTqBo2tNCF8rxSjhlmg5uo+MhzLwdrYdktjf3bI7QXF9pTQE7qXo4G0o9Bfd8 j0R4C+1v1jIqifD2tZJCVPByxA0BL9c= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-642-unv8mu4qOGC6x93bszLihg-1; Thu, 01 Dec 2022 08:01:25 -0500 X-MC-Unique: unv8mu4qOGC6x93bszLihg-1 Received: by mail-wm1-f70.google.com with SMTP id m34-20020a05600c3b2200b003cf549cb32bso2524202wms.1 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=qXAgOJf3hsLD98+Xi+6fWi9AZerSVkoSRWWselpqfTz0vOmjZXhQsTgGnWjPaiH6vb qYTrnpaOLFvM4ZT2QEdgb6dHtoskYolFknPwkZ9fq/qqsR4/Ku6d5h2D5x/aXUW7zJ25 JsKUMb5DPp1RJIwkbRxqaLfff89ZLvBiOuOZP9+vbmK3Vz/39ikKBTPJO0ad6kB3b+G9 4cnojmHz1nBaYCV3d0UQVctrqzgFaERWtCAblzr5VawDXfa85po0i+wAshPFRFVEbJcL b71Lwk72FQdZve9MUbinJpcc9yFZasOnU8j9MGg3E13V1S3tnTRwo/v4Ql2ckPAmVnxB RdHw== X-Gm-Message-State: ANoB5pngc0cOLLg3YEmyWn+1ZgX8mjOZfeHql82H76H6lxQhWbZ/3mrf cnjHnQ0IFELNFsSD4hrKwo873NhZkWkRZoQaF+y2sT5eEQZ+hLibzrEfC7Nc/IllC4d9IRwNGlS ieL9awEwfmoM= X-Received: by 2002:adf:f4cb:0:b0:242:3b56:cc79 with SMTP id h11-20020adff4cb000000b002423b56cc79mr1494427wrp.310.1669899684496; Thu, 01 Dec 2022 05:01:24 -0800 (PST) X-Google-Smtp-Source: AA0mqf5Q1wp/GBT8F2KRHWoEV0lTQae7B32mzgui7Kc4fgPi6S3v/UQciJOYVTUQx+7BbZwkvxBjaw== 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> From: David Hildenbrand Organization: Red Hat In-Reply-To: <1667971116-12900-1-git-send-email-quic_pkondeti@quicinc.com> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1669899694; a=rsa-sha256; cv=none; b=qWWiNZ/FyfHtsn7vFTH2StAHR+jRBvCFQLLxya6NTg1GYvcI8ZWTOsK7+NYwf2t7fvoOqQ o8lhng042DYXV48sK8cD9CIhXyTvjmC+8FhPrnO7WQ59jK+20M30GfRy3UFErWocp2iNy0 7iCALl/LYVJIvicpVA31oQBYhou/dCI= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=gGW7H99D; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf09.hostedemail.com: domain of david@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=david@redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1669899694; h=from:from:sender: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:dkim-signature; bh=YrLpv8IinAzI6TJvCdt8qSJlbjMH9iouKKI1hsHF2L4=; b=TAJzSHWazl8SzmeppYZJ0rraqXV9WZFe/NO6sEoi8N+vOo74McMWA1ABnGjs9RUYmFwrP1 AFu9DGO4ruXDYerPIL4eGuZinA6EvSY+pPX86SaLPUJO2SgfNJgSsSxJx0I0zxW/BjDr8j gr1y8bDqqQLOVVpNHDPcXBoKdYzIBAc= X-Rspamd-Queue-Id: CF684140035 X-Rspam-User: Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=gGW7H99D; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf09.hostedemail.com: domain of david@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=david@redhat.com X-Rspamd-Server: rspam09 X-Stat-Signature: 41hjdnh8m9ku5xs11qjubfzzzpx3paam X-HE-Tag: 1669899693-278459 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000047, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: > + * 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