Received: by 2002:a25:5b86:0:0:0:0:0 with SMTP id p128csp1141844ybb; Thu, 28 Mar 2019 21:13:26 -0700 (PDT) X-Google-Smtp-Source: APXvYqxfUphAgNJgjtN2hVLWmGj3vL0/r40tmIo8tTDrZX6memq2nO+IXxqJ9CsPMaBDhWJonI68 X-Received: by 2002:a63:1cd:: with SMTP id 196mr43907857pgb.58.1553832806831; Thu, 28 Mar 2019 21:13:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553832806; cv=none; d=google.com; s=arc-20160816; b=KYj1iYtWUQkiV88VQu0OsBNsVELaw20xMXpxAIddTqlHixqmdWQoVXpPotWOLuwGVd JCmz3SYI2C3m4pVNbW1CT26+f4bxiSdY6cq+erqZX1xrMJVRaCywUwWT5Yry+Ia7ycl5 oyfJ8WW0a5ji4SqLCzrydngcOGKUXXdvfNgdoobtk7MIb4kLZZKqQkfjxNzneGzq9Ia9 tsxDuc9XQnCEzyVOO+YafLl3nbie2d/UNjSw2QBDQz6GgavRpF0m0M1BjsTc1sY0NONG FMouZA0+om356P8pV1Jh8U6B+qwBwUqB2Vp9C4oiQRoAnuxVObKdDWIWnsnOYkMN8jhn DxBA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:cc:subject:to :message-id:from:date; bh=7PfGWTOe1hNdt+QyGU0Xt1MvnccRT51eycxXAs3a5VI=; b=ZBdKVtQiTnTayRDoizDHZpu0bp1IZJ3mWI5LzBBspJts5qEzz18K2Nzo0YN1ttuyt5 oYsONm+kXQ5k+iS41sdkLvnCXmnPJb2uS+azwl1/zZTt3/Cd9ZC+Kg02gF9gsx7cZnxV qQj9UF9u7yJoDBnfpF9EEuiJeIDJEUpivpFGAV7sX4fViYZJqQAb1t8s4N5DblCL5uLr /MyrgU5VbVJFh1syyq8KI3kIgXEWFkdHqZ7XaftmKmVp+U/3z1x9Du5gmzXWHxuu7fys Qci+ZdXEG26umKHMlCkwnFVgvSHWMRs9C/TOmxK7a0vSUOzTxPg5pcli7gSirnIrdziH vIbw== 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 s83si923381pgs.420.2019.03.28.21.13.10; Thu, 28 Mar 2019 21:13:26 -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 S1725932AbfC2EMg (ORCPT + 99 others); Fri, 29 Mar 2019 00:12:36 -0400 Received: from mx.sdf.org ([205.166.94.20]:64723 "EHLO mx.sdf.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725830AbfC2EMg (ORCPT ); Fri, 29 Mar 2019 00:12:36 -0400 Received: from sdf.org (IDENT:lkml@sdf.lonestar.org [205.166.94.16]) by mx.sdf.org (8.15.2/8.14.5) with ESMTPS id x2T4AEZC011474 (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256 bits) verified NO); Fri, 29 Mar 2019 04:10:14 GMT Received: (from lkml@localhost) by sdf.org (8.15.2/8.12.8/Submit) id x2T4ACjG014546; Fri, 29 Mar 2019 04:10:12 GMT Date: Fri, 29 Mar 2019 04:10:12 GMT From: George Spelvin Message-Id: <201903290410.x2T4ACjG014546@sdf.org> To: akpm@linux-foundation.org, lkml@sdf.org, lkp@intel.com, sfr@canb.auug.org.au Subject: Re: [RESEND PATCH v2 4/5] lib/list_sort: Simplify and remove MAX_LIST_LENGTH_BITS Cc: andriy.shevchenko@linux.intel.com, daniel.wagner@siemens.com, dchinner@redhat.com, don.mullis@gmail.com, geert@linux-m68k.org, kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org, linux@rasmusvillemoes.dk, st5pub@yandex.ru In-Reply-To: <20190328150851.5d261d1a72e2ca86a1c141c0@linux-foundation.org> References: , , <20190328150851.5d261d1a72e2ca86a1c141c0@linux-foundation.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Than you all for the build warning report. The warning produced by gcc versions 4.9, 7.3, 8.1, whatever version Stephen Rothwell is running, is: lib/list_sort.c:17:36: warning: __pure__ attribute ignored [-Wattributes] The relevant code is: 10: /* 11: * By declaring the compare function with the __pure attribute, we give 12: * the compiler more opportunity to optimize. Ideally, we'd use this in 13: * the prototype of list_sort(), but that would involve a lot of churn 14: * at all call sites, so just cast the function pointer passed in. 15: */ 16: typedef int __pure __attribute__((nonnull(2,3))) (*cmp_func)(void *, 17: struct list_head const *, struct list_head const *); As the comment says, the purpose of the __pure attribute is to tell the compiler that, after a call via a function pointer of this type, memory is not clobbered and it is not necessary to reload any cached list pointers. This is, of course, purely optional and may be deleted harmlessly. I just checked, and that makes no difference at all to gcc-8 code generation, so there's no point messing with #ifdef. There are only two questions: how to update the comment, and how to submit the fix. I'm thinking of /* * A more accurate type for comparison functions. Ideally, we'd use * this in the prototype of list_sort(), but that would involve a lot of * churn at all call sites, so just cast the function pointer passed in. * * This could also include __pure to give the compiler more opportunity * to optimize, but that elicits an "attribute ignored" warning on * GCC <= 8.1, and doesn't change GCC 8.3's code generation at all, * so it's omitted. */ How to submit the fix: Andrew, do you prefer a replacement patch or a small fix patch? I'll assume the latter and send it in a few minutes.