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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1E7E7C43334 for ; Thu, 7 Jul 2022 20:08:51 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id AE7956B0073; Thu, 7 Jul 2022 16:08:50 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A96846B0074; Thu, 7 Jul 2022 16:08:50 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 985F8900002; Thu, 7 Jul 2022 16:08:50 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 877A06B0073 for ; Thu, 7 Jul 2022 16:08:50 -0400 (EDT) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay12.hostedemail.com (Postfix) with ESMTP id 63A621202D0 for ; Thu, 7 Jul 2022 20:08:50 +0000 (UTC) X-FDA: 79661392020.14.AB56304 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf01.hostedemail.com (Postfix) with ESMTP id E91AE40013 for ; Thu, 7 Jul 2022 20:08:48 +0000 (UTC) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 1351A6236A; Thu, 7 Jul 2022 20:08:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3F56BC3411E; Thu, 7 Jul 2022 20:08:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1657224527; bh=zY70K4BHCW5WNY8eQsNCmHqlP2IvWjHkER236jjhzNA=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=uGkxhUtIGdEdq8IijXYGX2vnfU0ijccjpAHf+7VK6B+HTFbJaQGS8AjUyEhyALAEI gZcWtCKwzXa/BQ96Va6kWgVkU/d7W9d2ELIjDbMO9aqamLb2yxmnw7aKgLeZGqRxy5 298Z0O+J8pcYUf4dtLfa4s+FjtjdKBedpMG+a2Z4= Date: Thu, 7 Jul 2022 13:08:46 -0700 From: Andrew Morton To: Dan Carpenter Cc: kbuild@lists.01.org, Mel Gorman , lkp@intel.com, kbuild-all@lists.01.org, Linux Memory Management List , Nicolas Saenz Julienne Subject: Re: [kbuild] [linux-next:master 7884/8197] mm/page_alloc.c:3813 rmqueue_pcplist() warn: inconsistent returns 'flags'. Message-Id: <20220707130846.e3eb6b2f9f624a357c2c2ca5@linux-foundation.org> In-Reply-To: <202207071103.r5a2F97A-lkp@intel.com> References: <202207071103.r5a2F97A-lkp@intel.com> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.33; x86_64-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit ARC-Authentication-Results: i=1; imf01.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=uGkxhUtI; dmarc=none; spf=pass (imf01.hostedemail.com: domain of akpm@linux-foundation.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1657224529; h=from:from:sender:reply-to:subject:subject: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:dkim-signature; bh=TuMYH58XCeWgJrx8WfDOJNZGfQho17Lo7h2j7lujGlI=; b=KLxMxgViuSkIa7qtrUrRoDYLWQwRaDrPmC3IYIk29zUYawmHBE8OK8HDdNAOTL17le1vq+ afXpBH8Ic2lE40z/uicAdk7jaXCic+DX46WL3477ibHt95Kc8veq0aCugoE8Dc05rTh4cm bcSlOii2OJa0u/k6H+i2UGUhMWmWqLE= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1657224529; a=rsa-sha256; cv=none; b=NpIG08TJaTV2ehzgrU/kzgWnMu7caPJn3pyQouH0yZ3ZppeQ0pSQWBftWlgSAffRz2yLqL LGdMijRVDmBtZ7JwOBjO7PvPVSJb4sUTM1hfLpVDPU1WraCqKuR9P0c8ToPx01Qm22yUFx elSzs9DM5fFO8j6fLuVFXT7yOf7geWE= X-Stat-Signature: nhwcrqaqhr6hkyfiy5eajrzr841pfwd7 X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: E91AE40013 Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=uGkxhUtI; dmarc=none; spf=pass (imf01.hostedemail.com: domain of akpm@linux-foundation.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org X-Rspam-User: X-HE-Tag: 1657224528-94940 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, 7 Jul 2022 09:44:03 +0300 Dan Carpenter wrote: > tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master > head: 088b9c375534d905a4d337c78db3b3bfbb52c4a0 > commit: fdd1b94629bb5592abf40d0c7a572b58e4c0cadc [7884/8197] mm/page_alloc: protect PCP lists with a spinlock > config: i386-randconfig-m021 > compiler: gcc-11 (Debian 11.3.0-3) 11.3.0 > > If you fix the issue, kindly add following tag where applicable > Reported-by: kernel test robot > Reported-by: Dan Carpenter > > smatch warnings: > mm/page_alloc.c:3813 rmqueue_pcplist() warn: inconsistent returns 'flags'. > > vim +/flags +3813 mm/page_alloc.c > > 066b23935578d39 Mel Gorman 2017-02-24 3774 static struct page *rmqueue_pcplist(struct zone *preferred_zone, > 44042b4498728f4 Mel Gorman 2021-06-28 3775 struct zone *zone, unsigned int order, > 44042b4498728f4 Mel Gorman 2021-06-28 3776 gfp_t gfp_flags, int migratetype, > 44042b4498728f4 Mel Gorman 2021-06-28 3777 unsigned int alloc_flags) > 066b23935578d39 Mel Gorman 2017-02-24 3778 { > 066b23935578d39 Mel Gorman 2017-02-24 3779 struct per_cpu_pages *pcp; > 066b23935578d39 Mel Gorman 2017-02-24 3780 struct list_head *list; > 066b23935578d39 Mel Gorman 2017-02-24 3781 struct page *page; > d34b0733b452ca3 Mel Gorman 2017-04-20 3782 unsigned long flags; > fdd1b94629bb559 Mel Gorman 2022-06-24 3783 unsigned long __maybe_unused UP_flags; > 066b23935578d39 Mel Gorman 2017-02-24 3784 > dbbee9d5cd83f9d Mel Gorman 2021-06-28 3785 local_lock_irqsave(&pagesets.lock, flags); > 3b12e7e97938424 Mel Gorman 2021-06-28 3786 > fdd1b94629bb559 Mel Gorman 2022-06-24 3787 /* > fdd1b94629bb559 Mel Gorman 2022-06-24 3788 * spin_trylock may fail due to a parallel drain. In the future, the > fdd1b94629bb559 Mel Gorman 2022-06-24 3789 * trylock will also protect against IRQ reentrancy. > fdd1b94629bb559 Mel Gorman 2022-06-24 3790 */ > fdd1b94629bb559 Mel Gorman 2022-06-24 3791 pcp = this_cpu_ptr(zone->per_cpu_pageset); > fdd1b94629bb559 Mel Gorman 2022-06-24 3792 pcp_trylock_prepare(UP_flags); > fdd1b94629bb559 Mel Gorman 2022-06-24 3793 if (!spin_trylock(&pcp->lock)) { > fdd1b94629bb559 Mel Gorman 2022-06-24 3794 pcp_trylock_finish(UP_flags); > > Need to local_unlock_irqrestore(&pagesets.lock, flags); before return oops. Looks right. --- a/mm/page_alloc.c~mm-page_alloc-protect-pcp-lists-with-a-spinlock-fix +++ a/mm/page_alloc.c @@ -3792,6 +3792,7 @@ static struct page *rmqueue_pcplist(stru pcp_trylock_prepare(UP_flags); if (!spin_trylock(&pcp->lock)) { pcp_trylock_finish(UP_flags); + local_unlock_irqrestore(&pagesets.lock, flags); return NULL; } Do we really need the pcp_trylock_prepare/finish in there? local_lock_irqsave() already did that.