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 3FBBAC433F5 for ; Wed, 13 Apr 2022 01:26:23 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 76CFC6B0072; Tue, 12 Apr 2022 21:26:22 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 71CBD6B0073; Tue, 12 Apr 2022 21:26:22 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 60B496B0074; Tue, 12 Apr 2022 21:26:22 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.hostedemail.com [64.99.140.25]) by kanga.kvack.org (Postfix) with ESMTP id 506EE6B0072 for ; Tue, 12 Apr 2022 21:26:22 -0400 (EDT) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 136A71580 for ; Wed, 13 Apr 2022 01:26:22 +0000 (UTC) X-FDA: 79350115404.13.CCEF974 Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by imf01.hostedemail.com (Postfix) with ESMTP id D4C3E40005 for ; Wed, 13 Apr 2022 01:26:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1649813180; x=1681349180; h=message-id:subject:from:to:cc:date:in-reply-to: references:mime-version:content-transfer-encoding; bh=K1dFfKAGAqmFb2acfSDAZBnW2rzbquz+sm7/oVTChW8=; b=Lz9tdAJGmuEX3y3F8ckilDyYLEOWwn2BjWxYMmd5d71Kp0uMPCZGEP3/ zR7CfmgEM53HQl/f8ymlOPk5cfICkfTf2p0nZJ9jQaZjduvajJwp3dkqw LgOKS4Rl/4dPxUbqQZaIoodiWoKRurjn/W9XiFo8Mrvgl/fz68o1VJPMD sxRFApm+XIBe6+L7QocnaRRci+NcUrqPJPcwfrS6BaZ5fv5a9ZpMNldTe eV1ns4WwhyIE+5OliPnVauji2DudZH4kPxjdGxZ2B4PKrJr1UqfKztk5E qziNPPabo6aFfr1J/J0s9dtJeXtions11eOynwBkfAlnZnaImtpKMjDHR g==; X-IronPort-AV: E=McAfee;i="6400,9594,10315"; a="243130617" X-IronPort-AV: E=Sophos;i="5.90,255,1643702400"; d="scan'208";a="243130617" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Apr 2022 18:26:19 -0700 X-IronPort-AV: E=Sophos;i="5.90,255,1643702400"; d="scan'208";a="573049417" Received: from zouyunlo-mobl.ccr.corp.intel.com ([10.254.213.123]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Apr 2022 18:26:15 -0700 Message-ID: Subject: Re: [PATCH v2 2/9] mm/vmscan: remove unneeded can_split_huge_page check From: "ying.huang@intel.com" To: David Hildenbrand , Miaohe Lin , Oscar Salvador Cc: akpm@linux-foundation.org, songmuchun@bytedance.com, hch@infradead.org, willy@infradead.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Pavel Tatashin , John Hubbard , Linus Torvalds , Vlastimil Babka , Yu Zhao Date: Wed, 13 Apr 2022 09:26:13 +0800 In-Reply-To: References: <20220409093500.10329-1-linmiaohe@huawei.com> <20220409093500.10329-3-linmiaohe@huawei.com> <7455b680-3d89-5d3e-ba0e-6e4358b114a2@huawei.com> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.38.3-1 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Rspam-User: Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=Lz9tdAJG; spf=none (imf01.hostedemail.com: domain of ying.huang@intel.com has no SPF policy when checking 192.55.52.151) smtp.mailfrom=ying.huang@intel.com; dmarc=pass (policy=none) header.from=intel.com X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: D4C3E40005 X-Stat-Signature: 4nkoruu8ng79gkhe6dkpgygrkbeps93c X-HE-Tag: 1649813180-578889 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 Tue, 2022-04-12 at 16:59 +0200, David Hildenbrand wrote: > On 12.04.22 15:42, Miaohe Lin wrote: > > On 2022/4/12 16:59, Oscar Salvador wrote: > > > On Sat, Apr 09, 2022 at 05:34:53PM +0800, Miaohe Lin wrote: > > > > We don't need to check can_split_folio() because folio_maybe_dma_pinned() > > > > is checked before. It will avoid the long term pinned pages to be swapped > > > > out. And we can live with short term pinned pages. Without can_split_folio > > > > checking we can simplify the code. Also activate_locked can be changed to > > > > keep_locked as it's just short term pinning. > > > > > > What do you mean by "we can live with short term pinned pages"? > > > Does it mean that it was not pinned when we check > > > folio_maybe_dma_pinned() but now it is? > > > > > > To me it looks like the pinning is fluctuating and we rely on > > > split_folio_to_list() to see whether we succeed or not, and if not > > > we give it another spin in the next round? > > > > Yes. Short term pinned pages is relative to long term pinned pages and these pages won't be > > pinned for a noticeable time. So it's expected to split the folio successfully in the next > > round as the pinning is really fluctuating. Or am I miss something? > > > > Just so we're on the same page. folio_maybe_dma_pinned() only capture > FOLL_PIN, but not FOLL_GET. You can have long-term FOLL_GET right now > via vmsplice(). Per my original understanding, folio_maybe_dma_pinned() can be used to detect long-term pinned pages. And it seems reasonable to skip the long-term pinned pages and try short-term pinned pages during page reclaiming. But as you pointed out, vmsplice() doesn't use FOLL_PIN. So if vmsplice() is expected to pin pages for long time, and we have no way to detect it, then we should keep can_split_folio() in the original code. Copying more people who have worked on long-term pinning for comments. Best Regards, Huang, Ying > can_split_folio() is more precise then folio_maybe_dma_pinned(), but > both are racy as long as the page is still mapped. > >