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=-10.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham 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 24BA5C433DB for ; Thu, 18 Mar 2021 10:22:54 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id BBD3364E99 for ; Thu, 18 Mar 2021 10:22:53 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BBD3364E99 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=suse.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 2CC596B0070; Thu, 18 Mar 2021 06:22:53 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 242A66B0071; Thu, 18 Mar 2021 06:22:53 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0957D6B0072; Thu, 18 Mar 2021 06:22:53 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0225.hostedemail.com [216.40.44.225]) by kanga.kvack.org (Postfix) with ESMTP id DE08A6B0070 for ; Thu, 18 Mar 2021 06:22:52 -0400 (EDT) Received: from smtpin25.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 8D1B0181AF5FA for ; Thu, 18 Mar 2021 10:22:52 +0000 (UTC) X-FDA: 77932606584.25.FC36BB9 Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by imf19.hostedemail.com (Postfix) with ESMTP id E995F90009E8 for ; Thu, 18 Mar 2021 10:22:51 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1616062970; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=6drPy5++cy/jLxICKU45ttYyTRuG0/pKPjS/Nwj8Jvs=; b=JBzkA7hwJx0aIzuewbyoR+uidBiIKel4JFalCj7FtGVMQiJNn2NyZ5WRLyWVzVsdGFt8k3 IYnzEkIKJ/DPPJsGSeYexjcngPm8GCqAMUF5++UamGBqOlXXVvrC8MNUKWeIBPrjPHgkr5 l+1LUq+d1oONfo250qlHJ0HbBPj5B48= Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id C43DDAC1E; Thu, 18 Mar 2021 10:22:50 +0000 (UTC) Date: Thu, 18 Mar 2021 11:22:44 +0100 From: Michal Hocko To: Vlastimil Babka Cc: Oscar Salvador , Andrew Morton , David Hildenbrand , Muchun Song , Mike Kravetz , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v5 2/5] mm,compaction: Let isolate_migratepages_{range,block} return error codes Message-ID: References: <20210317111251.17808-1-osalvador@suse.de> <20210317111251.17808-3-osalvador@suse.de> <20210317143827.GA20965@linux> <843f68e7-6fe6-54e7-976b-af8647482ac1@suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <843f68e7-6fe6-54e7-976b-af8647482ac1@suse.cz> X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: E995F90009E8 X-Stat-Signature: maosntfown83dhm9tj53cxre1qpzyyir Received-SPF: none (suse.com>: No applicable sender policy available) receiver=imf19; identity=mailfrom; envelope-from=""; helo=mx2.suse.de; client-ip=195.135.220.15 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1616062971-824721 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 Thu 18-03-21 10:50:38, Vlastimil Babka wrote: > On 3/17/21 3:59 PM, Michal Hocko wrote: > > On Wed 17-03-21 15:38:35, Oscar Salvador wrote: > >> On Wed, Mar 17, 2021 at 03:12:29PM +0100, Michal Hocko wrote: > >> > > Since isolate_migratepages_block will stop returning the next pfn to be > >> > > scanned, we reuse the cc->migrate_pfn field to keep track of that. > >> > > >> > This looks hakish and I cannot really tell that users of cc->migrate_pfn > >> > work as intended. > > We did check those in detail. Of course it's possible to overlook something... > > The alloc_contig_range user never cared about cc->migrate_pfn. compaction > (isolate_migratepages() -> isolate_migratepages_block()) did, and > isolate_migratepages_block() returned the pfn only to be assigned to > cc->migrate_pfn in isolate_migratepages(). I think it's now better that > isolate_migratepages_block() sets it. > > >> When discussing this with Vlastimil, I came up with the idea of adding a new > >> field in compact_control struct, e.g: next_pfn_scan to keep track of the next > >> pfn to be scanned. > >> > >> But Vlastimil made me realize that since cc->migrate_pfn points to that aleady, > >> so we do not need any extra field. > > Yes, the first patch had at asome point: > > /* Record where migration scanner will be restarted. */ > cc->migrate_pfn = cc->the_new_field; > > Which was a clear sign that the new field is unnecessary. > > > This deserves a big fat comment. > > Comment where, saying what? :) E.g. something like the following diff --git a/mm/internal.h b/mm/internal.h index 1432feec62df..6c5a9066adf0 100644 --- a/mm/internal.h +++ b/mm/internal.h @@ -225,7 +225,13 @@ struct compact_control { unsigned int nr_freepages; /* Number of isolated free pages */ unsigned int nr_migratepages; /* Number of pages to migrate */ unsigned long free_pfn; /* isolate_freepages search base */ - unsigned long migrate_pfn; /* isolate_migratepages search base */ + unsigned long migrate_pfn; /* Acts as an in/out parameter to page + * isolation. + * isolate_migratepages uses it as a search base. + * isolate_migratepages_block will update the + * value the next pfn after the last isolated + * one. + */ unsigned long fast_start_pfn; /* a pfn to start linear scan from */ struct zone *zone; unsigned long total_migrate_scanned; Btw isolate_migratepages_block still has this comment which needs updating "The cc->migrate_pfn field is neither read nor updated." -- Michal Hocko SUSE Labs