Received: by 2002:a25:5b86:0:0:0:0:0 with SMTP id p128csp922452ybb; Thu, 28 Mar 2019 15:09:51 -0700 (PDT) X-Google-Smtp-Source: APXvYqynqrT7fIgWP4/+0hBWXLCE9wUv/d3eUwil9NjK8ZBH5JPcT77i+fYJlwowaRl3ziDXX17F X-Received: by 2002:a62:e10e:: with SMTP id q14mr5281161pfh.161.1553810990940; Thu, 28 Mar 2019 15:09:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553810990; cv=none; d=google.com; s=arc-20160816; b=IwFr/3oA9DAsVsJ60QBL4f/32wQKzApr127eC7H/1s2DdywPFEDdtJ5PemWxJZbuku 7XgDX7zyvEf9bQ1WeZrvl72oa9pdxXmcSkDS6sOO2Gqj3QNzwTIYlBm8wlRx7UYVW8Ig 4TYhO2TwDNKS6Qn8V2NI28usDuU/nEu+E8qjPDgByqecL0lmJdLJieUInLTpvbC9yJfi uxgDeKhdrGPC99dyofSLqWi5ttyJ9viBJBoCsQuVOsQQkJg0iMkQ1KbWAEa2mqMozizH Xv7vHIOQOZInVq1I/TP/qnY6zRoI9/dtbnk665KC6gUovDq2vQxWAqjehg/2kZZ66hcb jGvw== 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:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date; bh=abahat1Pegb7KgGTLC0KKyqcC/qlCWNSJoUGxefR70w=; b=DFMeEnGliBJwINeXyGuKgKcshkNh3v3xOilNZkWH8uHg4WXc2bkOg0J4W2xlWGsQZQ Z+QACTbaWNlHxEnxfL+mW0xqBlgMJ8gh+60spvNaHTcVzpfVoStOIoZDdvLaq99RSqbO S33ATis+eAj9F2OKnJIoKNK+TA1SZpCkcHMadU3mtVPqCmXS57PTfixLEs7VVROYk/Az 6Ix4cPfvNW5i7vDVEYoCXB/E3hTiTYoTi7t4/jxEup1F4i9+qHc5CtoQIEH85x0Dxp+c ui2OaEj3JqgEgxg1+HFLniLUHT+OlZYPqwzKwoRn+iOQHILA0/D5p9VPiNn8xkA0XJxp Mbfg== 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 w23si230335pga.454.2019.03.28.15.09.35; Thu, 28 Mar 2019 15:09:50 -0700 (PDT) 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 S1728125AbfC1WIx (ORCPT + 99 others); Thu, 28 Mar 2019 18:08:53 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:35086 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727238AbfC1WIw (ORCPT ); Thu, 28 Mar 2019 18:08:52 -0400 Received: from akpm3.svl.corp.google.com (unknown [104.133.8.65]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 30169D89; Thu, 28 Mar 2019 22:08:52 +0000 (UTC) Date: Thu, 28 Mar 2019 15:08:51 -0700 From: Andrew Morton To: George Spelvin Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Andrey Abramov , Geert Uytterhoeven , Daniel Wagner , Rasmus Villemoes , Don Mullis , Dave Chinner , Andy Shevchenko Subject: Re: [RESEND PATCH v2 4/5] lib/list_sort: Simplify and remove MAX_LIST_LENGTH_BITS Message-Id: <20190328150851.5d261d1a72e2ca86a1c141c0@linux-foundation.org> In-Reply-To: References: X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.31; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 19 Mar 2019 08:16:00 +0000 George Spelvin wrote: > Rather than a fixed-size array of pending sorted runs, use the ->prev > links to keep track of things. This reduces stack usage, eliminates > some ugly overflow handling, and reduces the code size. > > Also: > * merge() no longer needs to handle NULL inputs, so simplify. > * The same applies to merge_and_restore_back_links(), which is renamed > to the less ponderous merge_final(). (It's a static helper function, > so we don't need a super-descriptive name; comments will do.) > * Document the actual return value requirements on the (*cmp)() > function; some callers are already using this feature. > > x86-64 code size 1086 -> 739 bytes (-347) > > (Yes, I see checkpatch complaining about no space after comma in > "__attribute__((nonnull(2,3,4,5)))". Checkpatch is wrong.) x86_64 allnoconfig with gcc-7.3.0: lib/list_sort.c:17:36: warning: __pure__ attribute ignored [-Wattributes] struct list_head const *, struct list_head const *);