Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp96542pxb; Thu, 31 Mar 2022 00:11:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJylp5fr9mt250hGz4KIEQaOV/uXFWJRnBTNENxewFuHT5OkyNQp4FnIbw9VJSzWch08wYBo X-Received: by 2002:a17:906:5d06:b0:6df:b0ac:59c2 with SMTP id g6-20020a1709065d0600b006dfb0ac59c2mr3860104ejt.758.1648710707806; Thu, 31 Mar 2022 00:11:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648710707; cv=none; d=google.com; s=arc-20160816; b=cJSiXQYAi0j30Gwp1icgw5K0loJBOIubZPoN+FJpbosc4Q/UXKhq9jhoBvIGPHYGug rpoRX9Qe+6o+XqAorgCkIu0xt71+gXHOEYH3vQzAObOcqHu20mjJmU2tJeCGE7qUAK0/ 7As9oCM0p7/8JjRXBqp2Mbx+roqfLeUh0intpE/UMjBW2SvecJLUsKMqbnUOPuUxHVJm Gc3jpRpKRLjd7yc87xp1uJvX5pSYtWgnAzCNpWnn/HciJDm+fBFKu4N7DlyBIDtlJdu6 2eDTG+h+zwTpKAAVZVHhgqzM2mF5BSWphcjOJ1aWNNTZmEanzj6eUqRqeVpSPWxVk6PG bM0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from :dkim-signature; bh=QQJ2ROIOSbzJewf4Krt9nKSZ4UnHk+PyHajNWHICcZE=; b=MMEvJXNKMMJy89Dm9qVYyGfJvPbwPv61UwlGPP9M+hk/1st6lR7YV7YujlQcRKJuEl aypfSzEkzlSKzObGaLFCnJyaOM/xPIL0fzCBsbjFAPNQchuuBA8DPdU4O+5QLXC1Ytpp 7NM2os0hUREokA7Op/6NWA9r3wbft9dLnKMTxjXcWkMv7e/3sz4sBVFg+H+ayRFIZnd8 1Xd+ITuEMon/MAK5pB7oQIWOtiSb6bwTXVS48T+ml9xYdJLlQ2lNp3te72KWIFfq6FJD JXj8pN6tYAfPfGw0l3mfoMKqeXdxYlen+hcqLwMBk02WV8B+8ijTw5nPZIAl0oaCj5VF fAxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcdkim header.b=yQB++Tvy; 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=quicinc.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f25-20020a50fc99000000b00418c2b5bd33si20847831edq.21.2022.03.31.00.11.21; Thu, 31 Mar 2022 00:11:47 -0700 (PDT) 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=@quicinc.com header.s=qcdkim header.b=yQB++Tvy; 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=quicinc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231265AbiCaGko (ORCPT + 99 others); Thu, 31 Mar 2022 02:40:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55640 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231249AbiCaGkj (ORCPT ); Thu, 31 Mar 2022 02:40:39 -0400 Received: from alexa-out-sd-01.qualcomm.com (alexa-out-sd-01.qualcomm.com [199.106.114.38]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D87A65AA54 for ; Wed, 30 Mar 2022 23:38:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; i=@quicinc.com; q=dns/txt; s=qcdkim; t=1648708732; x=1680244732; h=from:to:cc:subject:date:message-id:mime-version; bh=QQJ2ROIOSbzJewf4Krt9nKSZ4UnHk+PyHajNWHICcZE=; b=yQB++TvydYV56pbQES9QklUg4wNyfSknkZBzYO3+vAsZQAuAFj81UOW+ hqccEWsEb8yuOQhvm1a+cbdT7eAfD+wSwg5B7saow/QL07wZRz/b8SdW+ 87BGST9b4Bp2e5kFcBHzj9UwZu5ru+stAE9tDNH9uwNQKHTnSVJ+NGOPP 8=; Received: from unknown (HELO ironmsg05-sd.qualcomm.com) ([10.53.140.145]) by alexa-out-sd-01.qualcomm.com with ESMTP; 30 Mar 2022 23:38:52 -0700 X-QCInternal: smtphost Received: from nasanex01c.na.qualcomm.com ([10.47.97.222]) by ironmsg05-sd.qualcomm.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Mar 2022 23:38:51 -0700 Received: from nalasex01a.na.qualcomm.com (10.47.209.196) by nasanex01c.na.qualcomm.com (10.47.97.222) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.22; Wed, 30 Mar 2022 23:38:51 -0700 Received: from hu-charante-hyd.qualcomm.com (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.22; Wed, 30 Mar 2022 23:38:48 -0700 From: Charan Teja Kalla To: , , , , , , CC: , , Charan Teja Reddy Subject: [PATCH RESEND V5,0/2]mm: shmem: support POSIX_FADV_[WILL|DONT]NEED for shmem files Date: Thu, 31 Mar 2022 12:08:19 +0530 Message-ID: X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nalasex01a.na.qualcomm.com (10.47.209.196) X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,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 From: Charan Teja Reddy This patch aims to implement POSIX_FADV_WILLNEED and POSIX_FADV_DONTNEED advices to shmem files which can be helpful for the drivers who may want to manage the pages of shmem files on their own, like, that are created through shmem_file_setup[_with_mnt](). Changes in V5: -- Moved the 'endbyte' calculations to a header function for use by shmem_fadvise(). -- Addressed comments from suren. -- No changes in resend. Retested on the latest tip. Changes in V4: -- Changed the code to use reclaim_pages() to writeout the shmem pages to swap and then reclaim. -- Addressed comments from Mark Hemment and Matthew. -- fadvise() on shmem file may even unmap a page. -- https://patchwork.kernel.org/project/linux-mm/patch/1644572051-24091-1-git-send-email-quic_charante@quicinc.com/ Changes in V3: -- Considered THP pages while doing FADVISE_[DONT|WILL]NEED, identified by Matthew. -- xarray used properly, as identified by Matthew. -- Excluded mapped pages as it requires unmapping and the man pages of fadvise don't talk about them. -- RESEND: Fixed the compilation issue when CONFIG_TMPFS is not defined. -- https://patchwork.kernel.org/project/linux-mm/patch/1641488717-13865-1-git-send-email-quic_charante@quicinc.com/ Changes in V2: -- Rearranged the code to not to sleep with rcu_lock while using xas_() functionality. -- Addressed the comments from Suren. -- https://patchwork.kernel.org/project/linux-mm/patch/1638442253-1591-1-git-send-email-quic_charante@quicinc.com/ changes in V1: -- Created the interface for fadvise(2) to work on shmem files. -- https://patchwork.kernel.org/project/linux-mm/patch/1633701982-22302-1-git-send-email-charante@codeaurora.org/ Charan Teja Reddy (2): mm: fadvise: move 'endbyte' calculations to helper function mm: shmem: implement POSIX_FADV_[WILL|DONT]NEED for shmem mm/fadvise.c | 11 +----- mm/internal.h | 21 ++++++++++ mm/shmem.c | 123 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 145 insertions(+), 10 deletions(-) -- 2.7.4