Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp764523pxp; Fri, 11 Mar 2022 14:30:54 -0800 (PST) X-Google-Smtp-Source: ABdhPJxRCCIx1dZHJXOt5sqLr4TXaA/z+ja9ywmXMM8fxSTAaymyjrvDqMlxFDI/uRVmoDgTCA+k X-Received: by 2002:a17:902:7143:b0:151:eea7:bc62 with SMTP id u3-20020a170902714300b00151eea7bc62mr12245696plm.122.1647037854343; Fri, 11 Mar 2022 14:30:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1647037854; cv=none; d=google.com; s=arc-20160816; b=SCfa7xPIhDznU+uoKVJhK+yNEuNCHMaUmFGr/V9TOs7mZEXbjmqD4of/mZPjw49DN7 teujh92AzNP/KcWYtQTB9MpnZQhryPYvPAQ9EjChgUXrLtEwuKC2ZalN30EMStrH7hGE a0+QkWfaQQ81Hw7zc+Rc+PAiEESTVTAufr3pt7v6cTbGyUVYd2LpJy9029qihJkmlK2q BN6ZxtvwZaKF8xPWVZFooZKXFYdgCnVD5rhvgEhym51f/dE8bV9rKuG/SGFSrPkTabNG jd9kd7QTgJrAwm6DwPCcIb0iGHlAkKTlMiIotLPeLkSi+QkTHDzyc+Oh9J/G66UH6gMW IBGg== 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=rHS7CYDdSDyF1yFLX+HLnjkYA6AhNc6C0NyOCdwp6uk=; b=uCXipdHnjKnixvzBGclrwiiXgTjiggGt8t1RVrwVcbRSjzuHJX2U2AAYdsuLF4W1p4 pZMUwr+jl2jKNR5xBJGHBHzLOCv7I6w9ZlbcA8jT2lCIeQwSsdpEIWtByV6k4J/4QX1A P4MMC//0CaBm2GbubPVcjWRzPE+MJ6rQp/mfbwe/FK22oM1ObIqf2FB0MR7n9wgI6AS2 wzNQpkueLvOYcq4/pOI5LkZyFY22RQBSKh6AQAosGrt6PD3BrQtRjoVoKoXV8xtufhqK ISsjV7n3owqttu89CgnJkc6ot1Ct8i1Du9mYEDGVrDDshJ9sQCCNxNUoF/LCaRh2q1OF 2GQA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcdkim header.b=g9duaCiG; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id o21-20020a635d55000000b003737c6010f6si9025869pgm.692.2022.03.11.14.30.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Mar 2022 14:30:54 -0800 (PST) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcdkim header.b=g9duaCiG; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 73C0E315390; Fri, 11 Mar 2022 13:36:30 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239875AbiCKKqI (ORCPT + 99 others); Fri, 11 Mar 2022 05:46:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40540 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233132AbiCKKqF (ORCPT ); Fri, 11 Mar 2022 05:46:05 -0500 Received: from alexa-out-sd-02.qualcomm.com (alexa-out-sd-02.qualcomm.com [199.106.114.39]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9F5A914EF65 for ; Fri, 11 Mar 2022 02:45:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; i=@quicinc.com; q=dns/txt; s=qcdkim; t=1646995501; x=1678531501; h=from:to:cc:subject:date:message-id:mime-version; bh=rHS7CYDdSDyF1yFLX+HLnjkYA6AhNc6C0NyOCdwp6uk=; b=g9duaCiGKUws8QKv9wVt7SQeBJQU94E+Ha0cd9zoPlwcAAsk84M7SAvH iuUH64kNaW4FqzVt4JfzOtBSnsnppR5V2MkMS2/wpzwfi2TCW8J/3MvNk pZXarOk1bHhlD/k3SQ81cTMa97xh/KOcaOF8QS+nnYksj57zBkQvaxK3U Y=; Received: from unknown (HELO ironmsg-SD-alpha.qualcomm.com) ([10.53.140.30]) by alexa-out-sd-02.qualcomm.com with ESMTP; 11 Mar 2022 02:45:01 -0800 X-QCInternal: smtphost Received: from nasanex01c.na.qualcomm.com ([10.47.97.222]) by ironmsg-SD-alpha.qualcomm.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Mar 2022 02:45:00 -0800 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.15; Fri, 11 Mar 2022 02:45:00 -0800 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.15; Fri, 11 Mar 2022 02:44:55 -0800 From: Charan Teja Kalla To: , , , , , , , , , CC: , , Charan Teja Kalla Subject: [PATCH V5,0/2] mm: shmem: support POSIX_FADV_[WILL|DONT]NEED for shmem files Date: Fri, 11 Mar 2022 16:13:50 +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=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 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. 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 Kalla (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