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 X-Spam-Level: X-Spam-Status: No, score=-5.9 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C2F35C432BE for ; Thu, 5 Aug 2021 02:04:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A3A9A6105A for ; Thu, 5 Aug 2021 02:04:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238067AbhHECES (ORCPT ); Wed, 4 Aug 2021 22:04:18 -0400 Received: from mail.kernel.org ([198.145.29.99]:52674 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231173AbhHECES (ORCPT ); Wed, 4 Aug 2021 22:04:18 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 8A41C60F43; Thu, 5 Aug 2021 02:04:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1628129043; bh=Jg/kMvGL/SQF9WUw42I1K/ZAjAPxlF9udF1stSAMnCY=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=QgoLYjhD8+ZU4OWWc3KoQGI8fuMPJxuSv3j1gUS76oyfV3aeF6YPnlVTymEl4xMky vI/VZ2FOdwl5veFgOoJVRWN6QQy6jityLJMbmw55wyN7XrZtL7k1X/Roe5vVplPPU3 SHSc3fTslltAT3I2fTioe89XkD0e+/Wt+hVkODPc= Date: Wed, 4 Aug 2021 19:04:02 -0700 From: Andrew Morton To: zhangkui Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-man@vger.kernel.org Subject: Re: [PATCH] mm/madvise: add MADV_WILLNEED to process_madvise() Message-Id: <20210804190402.8b9dbac3c4f417945c6d1de2@linux-foundation.org> In-Reply-To: <20210804082010.12482-1-zhangkui@oppo.com> References: <20210804082010.12482-1-zhangkui@oppo.com> X-Mailer: Sylpheed 3.5.1 (GTK+ 2.24.32; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 4 Aug 2021 16:20:10 +0800 zhangkui wrote: > There is a usecase in Android that an app process's memory is swapped out > by process_madvise() with MADV_PAGEOUT, such as the memory is swapped to > zram or a backing device. When the process is scheduled to running, like > switch to foreground, multiple page faults may cause the app dropped > frames. > To reduce the problem, SMS can read-ahead memory of the process immediately > when the app switches to forground. > Calling process_madvise() with MADV_WILLNEED can meet this need. This will require a small update to the process_madvise(2) manpage. Can you please send a patch?