Received: by 2002:a05:7412:e794:b0:fa:551:50a7 with SMTP id o20csp1731702rdd; Thu, 11 Jan 2024 07:43:21 -0800 (PST) X-Google-Smtp-Source: AGHT+IFgAIWvORnN0nIhkGExZRwaIMkoiPGAVfhiQKzJ0GzmOHAbowSDASynQczYaDVxO3bviXsT X-Received: by 2002:a0c:a9d9:0:b0:681:24af:49b7 with SMTP id c25-20020a0ca9d9000000b0068124af49b7mr1020187qvb.27.1704987801642; Thu, 11 Jan 2024 07:43:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704987801; cv=none; d=google.com; s=arc-20160816; b=ri5+1hdzZ0uzPoFsUv01teewo2Lgwsp/HJzHZXZFEq2i25EzoXTCEKJIDiliqj0zrK /UfuSM2CTqoU5XdQNZwJcg3rOfkvyOEI2zhm6KjRrjt0gfsUE2ZUZqlM+xw+W7J6Whm2 iijfQhBJVFmNdF0Wae1tL6e588eYRC6ZgK+MbWej28CbUic46WqMH9tUhvCNCyphovYr 7zqIvcFyJw/7383X3CC2rPy2iYZJfQMLVdyasymsRsu5MQpQ2zBv+MWKo3LMC5K5/fvw xJw36yws0FOtmb13U4xUu8T6toffS13uyOH3/Kt3b7xqJE+i+vTD125VFAmEWOL/WiPA 0MnA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=f0WKgYvjDECipv9mPaobkrjCiQPa+DAi1vYNwUvjneA=; fh=n605JP9ZZj9vhIkSY232aWbYGMfUPVjOVBuh/vEEFOg=; b=tggQo4JiOi9rTN2t/Y9FtAVxHuWO+JovOD3E4SDpNGhFHf1MCWGyiXpvIoRqo0nDKy WGk7SQx4On7A0WROKbSTTF3KDBNP85hjV0MsjRbYC1+z55mLLbyu1bXlgnsyIKHJy6f+ 7B36L5d0ffFo4WRUk/dWNseNp7TXkALrA4DBBZxD+X74FrBg0vlb9VKlweySyaFRPIw3 wNU0H2PSyh6OgA6Zf+CCTioJOEsUXOuYyt5Uy7MrS9SmZNFMtMiWBKlLcMU9jvqZ/ORS jvO0GGPy0d5AJ4/cZr9Kff2IVE/ZEtDOvBRSUvkyvxUoP3ve6MVn2LIMyEx3UAI9942L RByQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@infradead.org header.s=casper.20170209 header.b=a8FjhmeW; spf=pass (google.com: domain of linux-kernel+bounces-23809-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-23809-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id c11-20020ac85a8b000000b004299892f32asi1146541qtc.502.2024.01.11.07.43.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Jan 2024 07:43:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-23809-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@infradead.org header.s=casper.20170209 header.b=a8FjhmeW; spf=pass (google.com: domain of linux-kernel+bounces-23809-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-23809-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 515621C242EF for ; Thu, 11 Jan 2024 15:43:21 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 27B044D13A; Thu, 11 Jan 2024 15:43:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="a8FjhmeW" Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 264844CDE9 for ; Thu, 11 Jan 2024 15:43:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org 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=sR5kHhCjagV8uFMXl3/LAFaeai/wqgvLhgx2A6zTtjM=; b=a8FjhmeWa6TJk6IBOqdChOdsYT I9GmztgxE+FHG6rrPOmwl8E6jduXfoiTjhUSh7R98ZmFvu2a2F3r+sHl29XtJTO1bQqm3FttR9PTD sE3bNiXz3mvA9lkxkFK9cWB7EfVkQV38ZZscJapxiARKVTDlYtvR/GQHYC2Xh/G4X6KJPuMPUocDv YjzW2LChvj6egeHtHLieE0rpYyzCVHI984BwY+6myf1MrvOu7hyUhzuZvWhVPN+KA9B+WbuJV1zwe 7/RCKlTRMuE575YJqpPhiTgRBaE1Q5v//sjCWHX1y5uU5vq3T0ZSPNd+vqQfaPYyLIJk+wkE1NzJr dHc2rihQ==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1rNxCp-00ECOD-8R; Thu, 11 Jan 2024 15:42:55 +0000 Date: Thu, 11 Jan 2024 15:42:55 +0000 From: Matthew Wilcox To: Byungchul Park Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, kernel_team@skhynix.com, akpm@linux-foundation.org, ying.huang@intel.com, namit@vmware.com, xhao@linux.alibaba.com, mgorman@techsingularity.net, hughd@google.com, david@redhat.com, peterz@infradead.org, luto@kernel.org, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com Subject: Re: [v5 4/7] mm: Separate move/undo doing on folio list from migrate_pages_batch() Message-ID: References: <20240111060757.13563-1-byungchul@sk.com> <20240111060757.13563-5-byungchul@sk.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240111060757.13563-5-byungchul@sk.com> On Thu, Jan 11, 2024 at 03:07:54PM +0900, Byungchul Park wrote: > +static void migrate_folios_move(struct list_head *src_folios, > + struct list_head *dst_folios, > + free_folio_t put_new_folio, unsigned long private, > + enum migrate_mode mode, int reason, > + struct list_head *ret_folios, > + struct migrate_pages_stats *stats, > + int *retry, int *thp_retry, int *nr_failed, > + int *nr_retry_pages) > +{ > + struct folio *folio, *folio2, *dst, *dst2; > + bool is_thp; > + int nr_pages; > + int rc; > + > + dst = list_first_entry(dst_folios, struct folio, lru); > + dst2 = list_next_entry(dst, lru); > + list_for_each_entry_safe(folio, folio2, src_folios, lru) { > + is_thp = folio_test_large(folio) && folio_test_pmd_mappable(folio); You don't need to call folio_test_large() first. folio_order() includes a call to test_large() so it can return 0. > + nr_pages = folio_nr_pages(folio); .. or since you're calculating this anyway, is_thp = nr_pages >= HPAGE_PMD_NR perhaps