Received: by 10.213.65.68 with SMTP id h4csp640336imn; Fri, 6 Apr 2018 06:36:40 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+7lSQpOwgPReXz2qTvQUmIqY/saIk1OZPHMNLgWyYrccDMwRh8aRAsUhZRbFeIOTMwDnB8 X-Received: by 10.101.98.196 with SMTP id m4mr6425392pgv.329.1523021799999; Fri, 06 Apr 2018 06:36:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523021799; cv=none; d=google.com; s=arc-20160816; b=nIPkf0X4oik4u8Og3jaJB+F4MdfGT6pnO5lwmyVZJeNK8Jv8N93y7+Q/sV2T28oBNa dRAB+LIY0FMrn4SOYTySfjgXJCkNrJmPAPlWdXLYAXk9Pwj5U06qdh4RZBxu9rTKW6kq cMerLwnf/GMksD3k/VJ0LziC6VLPM3Zzwl5AJfVcHvx7KHbiCszlxxNqeyVtP+Oz2JOn 5P3dHwMjG4vihS6Ai4ql365rFRducKuyuXO7eMZWL1Y78yB9eIGNYTiXrSlLsYCcVoIa NXsHon+tovnnm25EuzH22lAUUIvhzUGdm8wXd839Et6lbqOcwJvkDZSJxBRO97mKs9Zg eJKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=y0OrqT6sb6zyh62v8Bw1rL0Mj4wnWbmO8/1oSx0FY04=; b=y0ZhDa/755OpjtHI9xIU8UkAdpoA9R+XsMkLK4RvGMZC6J43u/rVLvd8/rmfQNxhn/ hYL+phUX0ib2Ocvwws+NL5grOE5fe7mPeIWlwZ3O5aGquN4mmHi7cvBbnTER+ERLJC7q ESHxmrPB3jbnkJveTuzJM+QtXN7h8UmNV6ZrKXXcVhIy0mgT+dZITNWmE2MDqTlHxFiS q4247HDIamni+u3XzlXWgYXociUP1fZW1ADNAv/2CKVJtnIJZlfCy9D7iDSj9wgUvFss mWcKbmWrGfJMPzANAcCfN14I2g+5kYAfgmZNHpjeKtY7n707woP6SHFUnmMa6UCmyp8n De5A== 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 u184si7166902pgc.699.2018.04.06.06.36.25; Fri, 06 Apr 2018 06:36:39 -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 S1756030AbeDFNfY (ORCPT + 99 others); Fri, 6 Apr 2018 09:35:24 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:58766 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752794AbeDFNfV (ORCPT ); Fri, 6 Apr 2018 09:35:21 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 3939EDCF; Fri, 6 Apr 2018 13:35:20 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nick Desaulniers , Michal Hocko , Andrew Morton , Linus Torvalds , Nathan Chancellor Subject: [PATCH 4.9 034/102] mm/vmscan.c: fix unsequenced modification and access warning Date: Fri, 6 Apr 2018 15:23:15 +0200 Message-Id: <20180406084336.435349772@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180406084331.507038179@linuxfoundation.org> References: <20180406084331.507038179@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.9-stable review patch. If anyone has any objections, please let me know. ------------------ From: Nick Desaulniers commit f2f43e566a02a3bdde0a65e6a2e88d707c212a29 upstream. Clang and its -Wunsequenced emits a warning mm/vmscan.c:2961:25: error: unsequenced modification and access to 'gfp_mask' [-Wunsequenced] .gfp_mask = (gfp_mask = current_gfp_context(gfp_mask)), ^ While it is not clear to me whether the initialization code violates the specification (6.7.8 par 19 (ISO/IEC 9899) looks like it disagrees) the code is quite confusing and worth cleaning up anyway. Fix this by reusing sc.gfp_mask rather than the updated input gfp_mask parameter. Link: http://lkml.kernel.org/r/20170510154030.10720-1-nick.desaulniers@gmail.com Signed-off-by: Nick Desaulniers Acked-by: Michal Hocko Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds [natechancellor: Adjust context due to abscence of 7dea19f9ee63] Signed-off-by: Nathan Chancellor Signed-off-by: Greg Kroah-Hartman --- mm/vmscan.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -2966,7 +2966,7 @@ unsigned long try_to_free_pages(struct z unsigned long nr_reclaimed; struct scan_control sc = { .nr_to_reclaim = SWAP_CLUSTER_MAX, - .gfp_mask = (gfp_mask = memalloc_noio_flags(gfp_mask)), + .gfp_mask = memalloc_noio_flags(gfp_mask), .reclaim_idx = gfp_zone(gfp_mask), .order = order, .nodemask = nodemask, @@ -2981,12 +2981,12 @@ unsigned long try_to_free_pages(struct z * 1 is returned so that the page allocator does not OOM kill at this * point. */ - if (throttle_direct_reclaim(gfp_mask, zonelist, nodemask)) + if (throttle_direct_reclaim(sc.gfp_mask, zonelist, nodemask)) return 1; trace_mm_vmscan_direct_reclaim_begin(order, sc.may_writepage, - gfp_mask, + sc.gfp_mask, sc.reclaim_idx); nr_reclaimed = do_try_to_free_pages(zonelist, &sc); @@ -3749,16 +3749,15 @@ static int __node_reclaim(struct pglist_ const unsigned long nr_pages = 1 << order; struct task_struct *p = current; struct reclaim_state reclaim_state; - int classzone_idx = gfp_zone(gfp_mask); struct scan_control sc = { .nr_to_reclaim = max(nr_pages, SWAP_CLUSTER_MAX), - .gfp_mask = (gfp_mask = memalloc_noio_flags(gfp_mask)), + .gfp_mask = memalloc_noio_flags(gfp_mask), .order = order, .priority = NODE_RECLAIM_PRIORITY, .may_writepage = !!(node_reclaim_mode & RECLAIM_WRITE), .may_unmap = !!(node_reclaim_mode & RECLAIM_UNMAP), .may_swap = 1, - .reclaim_idx = classzone_idx, + .reclaim_idx = gfp_zone(gfp_mask), }; cond_resched(); @@ -3768,7 +3767,7 @@ static int __node_reclaim(struct pglist_ * and RECLAIM_UNMAP. */ p->flags |= PF_MEMALLOC | PF_SWAPWRITE; - lockdep_set_current_reclaim_state(gfp_mask); + lockdep_set_current_reclaim_state(sc.gfp_mask); reclaim_state.reclaimed_slab = 0; p->reclaim_state = &reclaim_state;