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 A7F03C433EF for ; Wed, 15 Dec 2021 13:56:03 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3B8726B0071; Wed, 15 Dec 2021 08:55:53 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 31CD56B0073; Wed, 15 Dec 2021 08:55:53 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1E53D6B0074; Wed, 15 Dec 2021 08:55:53 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0252.hostedemail.com [216.40.44.252]) by kanga.kvack.org (Postfix) with ESMTP id 04ADE6B0071 for ; Wed, 15 Dec 2021 08:55:53 -0500 (EST) Received: from smtpin28.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id B2244180E1E25 for ; Wed, 15 Dec 2021 13:55:42 +0000 (UTC) X-FDA: 78920176524.28.FA0A69A Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf23.hostedemail.com (Postfix) with ESMTP id 9FB28140011 for ; Wed, 15 Dec 2021 13:55:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=a013eJX1aHtsqswhayydKikJ5V9/pgFksAiCn8UNcqg=; b=HXsoY3erz1u5qJvYJzxMOoLb50 k76ad25a8Hv7gm+b8J7PS3w5muOIIuFR6IPB+rknQMpp650BvH6phl0c2sLSDnHk6rG82QS4yO7uk +yczrPEsFzvkZeI6JPTRgIL8ibL39mJ4qgexFOKesT9Rn5iY67GEbYQm+CxrM5ANPlIJfV+zlNBMS qHUGCkHVitvQ9/8F+8Z8IHuP67e81UR79iUDtjKAigfBdI/19yyyvCQOmxwMCFandPrHw36ZjG6BI f7DwHlDahpjULAKLrmDKJ/rPbbJjgGBhGeGnaJd8jSc5mkJlI7nn0tl5hVCAkOI2AgaZPmK98DunU CN7JPeJQ==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1mxUkp-00EhGu-An; Wed, 15 Dec 2021 13:55:35 +0000 Date: Wed, 15 Dec 2021 13:55:35 +0000 From: Matthew Wilcox To: Charan Teja Reddy Cc: akpm@linux-foundation.org, minchan@kernel.org, surenb@google.com, vbabka@suse.cz, rientjes@google.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] mm/madvise: elevate page refcount while isolating in process_madvise() Message-ID: References: <1639571019-30043-1-git-send-email-quic_charante@quicinc.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1639571019-30043-1-git-send-email-quic_charante@quicinc.com> X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 9FB28140011 X-Stat-Signature: b4y7o6zdu3apekt9f9ubkh9xahrrodr3 Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=HXsoY3er; spf=none (imf23.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none X-HE-Tag: 1639576538-380635 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Wed, Dec 15, 2021 at 05:53:39PM +0530, Charan Teja Reddy wrote: > The documentation of isolate_lru_page() says that, "it must be called > with an elevated refcount on the page", which is not followed while > isolating pages in process_madvise() system call with advise > MADV_PAGEOUT. Fix it. We hold the mmap_lock over the call to this function, so the reference to the page from the page tables cannot go away. There's no need to grab an extra reference here.