Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3507825pxb; Mon, 24 Jan 2022 11:01:45 -0800 (PST) X-Google-Smtp-Source: ABdhPJzOUgo+xIzwGWj/5YdThDUtrd+E3F85NlUl9BmI4CYxFba2A6xDQ+RkCLSF9sUdnBST/iK+ X-Received: by 2002:aa7:9562:0:b0:4c9:f1a0:e0d0 with SMTP id x2-20020aa79562000000b004c9f1a0e0d0mr3010933pfq.53.1643050905578; Mon, 24 Jan 2022 11:01:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643050905; cv=none; d=google.com; s=arc-20160816; b=gJrlUMOz2D9aehIHMMTn/Wz7Ypz8D7/E+2Zq/9Nfc0N3Z2Ps/9cmNFNPk+arG7IsFa MZwsH9thu5cC6IrYoewb5QF1uwcxiaDE0FBR/iiWeodxJKkzfbaHR84h2fTGSALB36gl lNJ3A2zRb10D8bydR3kkwHlun0WYVSmq/dx4AOq+km7/HgVmXoGlYdXzM3PCyKPSFTcg +ZwMMw3ys2zNhXVKCMBlX8kMxeXuLEhHUkfMdaSXjtCGdU2NCOCtg9ncV/rb0bHkeCND ycRVPwQnW6EouadQ6f3FjmibkZq0b4Mj/Pbq3oUJ2aqS/23bO+DwcRCRYk2p8/+aZQgJ p8mg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:message-id:user-agent :references:in-reply-to:subject:cc:to:from:date:mime-version :dkim-signature:dkim-signature; bh=UY9IYgd8hkKnbM1EBvRlpgL7L8s4nRO/7Rp2w0hALcQ=; b=Kedx2A9YMtLlNR1srvlD32vSa2qquU3Zeoy25wsaNDO6k0fAPTmi6odN8IQ+9/Jrbr zYsh5E+Hexn4ipWXDY2303nLCfYESv8C9xV3WVz1zuxjJktknyqcLwgNwNDEmnpes5oS g4SnEsgdxAU4PPzLzPX5DIgvPjPZYNWLms16LYhRc1akbVwcocRBF2wCaZOkikJr2aCy y/Nu0f2wnFJvVKAhqnXMVn3v/n0nPt4E3lYoi9yhQ/hVzfiLl2cozbHtd72B6LHA2TJQ 0bcC9NTyPvckhVUVhykkfRD1Xz4PHDrjiUrOvBReBaNz0iBxn3wPKukfaRWoykD+Btl0 z56w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=KGtiw7Mb; dkim=neutral (no key) header.i=@suse.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g10si13895847pgc.517.2022.01.24.11.01.32; Mon, 24 Jan 2022 11:01:45 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=KGtiw7Mb; dkim=neutral (no key) header.i=@suse.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236869AbiAXJzq (ORCPT + 99 others); Mon, 24 Jan 2022 04:55:46 -0500 Received: from smtp-out2.suse.de ([195.135.220.29]:46242 "EHLO smtp-out2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234706AbiAXJzp (ORCPT ); Mon, 24 Jan 2022 04:55:45 -0500 Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 1C8DE1F88E; Mon, 24 Jan 2022 09:55:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1643018144; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=UY9IYgd8hkKnbM1EBvRlpgL7L8s4nRO/7Rp2w0hALcQ=; b=KGtiw7MbrqbtdwmTIN21tihOEMjPY1IV7E0JkU89QUCci4JpOtfDiI1XTrJgmG4yZjZ9h7 s1QgPOwhButRlG3q7JdTF3j9Cqv/X0oB27ZmmEEx3x//gMB3DOms+1sYO1DHzzism3ATYl 636sePlLdPVWWR3UHlLv7khhAx6FVgk= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1643018144; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=UY9IYgd8hkKnbM1EBvRlpgL7L8s4nRO/7Rp2w0hALcQ=; b=pccFyVChZpI+deG/lwWKxfYZX5Ho6yT54MMe43//zUOjCgx34C1UbYttn5zp4g777PCZbJ q1YdEzxEBH/2CrCQ== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 062BA13AB8; Mon, 24 Jan 2022 09:55:44 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id etlEAaB37mEqVwAAMHmgww (envelope-from ); Mon, 24 Jan 2022 09:55:44 +0000 MIME-Version: 1.0 Date: Mon, 24 Jan 2022 10:55:43 +0100 From: Oscar Salvador To: Zi Yan Cc: David Hildenbrand , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Michael Ellerman , Christoph Hellwig , Marek Szyprowski , Robin Murphy , linuxppc-dev@lists.ozlabs.org, virtualization@lists.linux-foundation.org, iommu@lists.linux-foundation.org, Vlastimil Babka , Mel Gorman , Eric Ren Subject: Re: [PATCH v4 3/7] mm: page_isolation: check specified range for unmovable pages In-Reply-To: <20220119190623.1029355-4-zi.yan@sent.com> References: <20220119190623.1029355-1-zi.yan@sent.com> <20220119190623.1029355-4-zi.yan@sent.com> User-Agent: Roundcube Webmail Message-ID: X-Sender: osalvador@suse.de Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2022-01-19 20:06, Zi Yan wrote: > From: Zi Yan > > Enable set_migratetype_isolate() to check specified sub-range for > unmovable pages during isolation. Page isolation is done > at max(MAX_ORDER_NR_PAEGS, pageblock_nr_pages) granularity, but not all > pages within that granularity are intended to be isolated. For example, > alloc_contig_range(), which uses page isolation, allows ranges without > alignment. This commit makes unmovable page check only look for > interesting pages, so that page isolation can succeed for any > non-overlapping ranges. Hi Zi Yan, I had to re-read this several times as I found this a bit misleading. I was mainly confused by the fact that memory_hotplug does isolation on PAGES_PER_SECTION granularity, and reading the above seems to indicate that either do it at MAX_ORDER_NR_PAGES or at pageblock_nr_pages granularity. True is that start_isolate_page_range() expects the range to be pageblock aligned and works in pageblock_nr_pages chunks, but I do not think that is what you meant to say here. Now, to the change itself, below: > @@ -47,8 +51,8 @@ static struct page *has_unmovable_pages(struct zone > *zone, struct page *page, > return page; > } > > - for (; iter < pageblock_nr_pages - offset; iter++) { > - page = pfn_to_page(pfn + iter); > + for (pfn = first_pfn; pfn < last_pfn; pfn++) { You already did pfn = first_pfn before. > /** > * start_isolate_page_range() - make page-allocation-type of range of > pages to > * be MIGRATE_ISOLATE. > - * @start_pfn: The lower PFN of the range to be isolated. > - * @end_pfn: The upper PFN of the range to be isolated. > + * @start_pfn: The lower PFN of the range to be checked for > + * possibility of isolation. > + * @end_pfn: The upper PFN of the range to be checked for > + * possibility of isolation. > + * @isolate_start: The lower PFN of the range to be isolated. > + * @isolate_end: The upper PFN of the range to be isolated. So, what does "possibility" means here. I think this need to be clarified a bit better. From what you pointed out in the commit message I think what you are doing is: - alloc_contig_range() gets a range to be isolated. - then you pass two ranges to start_isolate_page_range() (start_pfn, end_pfn]: which is the unaligned range you got in alloc_contig_range() (isolate_start, isolate_end]: which got aligned to, let's say, to MAX_ORDER_NR_PAGES Now, most likely, (start_pfn, end_pfn] only covers a sub-range of (isolate_start, isolate_end], and that sub-range is what you really want to isolate (so (start_pfn, end_pfn])? If so, should not the names be reversed? -- Oscar Salvador SUSE Labs