Received: by 2002:ac0:8c9a:0:0:0:0:0 with SMTP id r26csp525829ima; Fri, 1 Feb 2019 06:59:07 -0800 (PST) X-Google-Smtp-Source: AHgI3IbmWvrtZaAUppZXFClcAm7R0x4q8iOq35Sv6/wRv1DpHSIOyE5KCvt9+2fDQ35Qdge4LLx+ X-Received: by 2002:a63:cd4c:: with SMTP id a12mr2562771pgj.252.1549033147452; Fri, 01 Feb 2019 06:59:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549033147; cv=none; d=google.com; s=arc-20160816; b=NJ+LenHuJYYJ4kYF2XToiaACo+X4MXhGoftnY+389ICZY5uayNZt5LIo5xxIvFfI05 mk+lDsNkWrlhcVzac0rXom5dWcwsoPt1EsBFdD9c5ZmhJCDVnjDJ6fagGQ4niWYx9v71 QPW5xquUwaEW2sc6RMNfpkWz78BAebWbBUsuVdK7+WYSKzm5xlGmO+IQoLcbzwBDXhIb 92eXrQhCkzOM/pHv9smANkqB7mirUi+G+HSTq5k/UP4M9MEAiGPRDy57xPizP09rjj8u FRdf1OzdbU7VGSLC//F3llhK4IIsPmZtE0izE/3kB3yvIKxTT346groB/x+sIA93gXZi J3Dw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:openpgp:from:references:cc:to:subject; bh=gsEtjM55k7xtDSDIybAY6hyEqYQBgSdrviFl4r9SCQM=; b=PgrmAknnn2iGG5lPlyMk5S9jvRKqHAglZhADBEPKWj2zsfzCEdO+ugECpyATsjP3aO jXtH2dEadvxQc4gmiI6ZPCqd6BQ0LYtn8dFOQQpkkE6YbXPZv18TOh08k1tHaL14ulBi 1OGPRz9n9vCwDFhOPz6BG6uW79e0u6RgYWYZhVQerkzlRjY3jw0aZRtQISGIjs7xxKNn CbviMWxHgLV7nXSfcuA0CEegz6vtedIwh27PgT08lESzMyPiWyHybnFj1Sm86ghpL8JC bOjlWA7uFNzZ7d/gaXD1x128HtKzXq/u2/mQYRRlu5hvMBR3APfw38CM3GxxsczmYQXO vnpQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l7si7533832pfg.245.2019.02.01.06.58.51; Fri, 01 Feb 2019 06:59:07 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729745AbfBAO6W (ORCPT + 99 others); Fri, 1 Feb 2019 09:58:22 -0500 Received: from mx2.suse.de ([195.135.220.15]:53950 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726446AbfBAO6W (ORCPT ); Fri, 1 Feb 2019 09:58:22 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id E3D74AC90; Fri, 1 Feb 2019 14:58:20 +0000 (UTC) Subject: Re: [PATCH 11/22] mm, compaction: Use free lists to quickly locate a migration target To: Mel Gorman Cc: Andrew Morton , David Rientjes , Andrea Arcangeli , Linux List Kernel Mailing , Linux-MM References: <20190118175136.31341-1-mgorman@techsingularity.net> <20190118175136.31341-12-mgorman@techsingularity.net> <81e45dc0-c107-015b-e167-19d7ca4b6374@suse.cz> <20190201145139.GI9565@techsingularity.net> From: Vlastimil Babka Openpgp: preference=signencrypt Message-ID: Date: Fri, 1 Feb 2019 15:58:19 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0 MIME-Version: 1.0 In-Reply-To: <20190201145139.GI9565@techsingularity.net> Content-Type: text/plain; charset=iso-8859-15 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2/1/19 3:51 PM, Mel Gorman wrote: > On Thu, Jan 31, 2019 at 03:52:10PM +0100, Vlastimil Babka wrote: >>> -/* Reorder the free list to reduce repeated future searches */ >>> +/* >>> + * Used when scanning for a suitable migration target which scans freelists >>> + * in reverse. Reorders the list such as the unscanned pages are scanned >>> + * first on the next iteration of the free scanner >>> + */ >>> +static void >>> +move_freelist_head(struct list_head *freelist, struct page *freepage) >>> +{ >>> + LIST_HEAD(sublist); >>> + >>> + if (!list_is_last(freelist, &freepage->lru)) { >> >> Shouldn't there be list_is_first() for symmetry? >> > > I don't think it would help. We're reverse traversing the list when this is > called. If it's the last entry, it's moving just one page before breaking > off the search and a shuffle has minimal impact. If it's the first page > then list_cut_before moves the entire list to sublist before splicing it > back so it's a pointless operation. Yeah I thought the goal was to avoid the pointless operation, which is why it was previously added as "if (!list_is_last())" in move_freelist_head(). So in move_freelist_head() it would have to be as "if (!list_is_first())" to achieve the same effect. Agree that it's marginal but if that's so then I would just remove the checks completely (from both functions) instead of having it subtly wrong in one of them?