Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp468895imm; Fri, 31 Aug 2018 05:25:28 -0700 (PDT) X-Google-Smtp-Source: ANB0VdbCATq4mrWOvzKeFR30P4mZ6QYWgwWKINjuKIgQH2mHmuTduLZSXZpj1pDF0/E1cqtBJf4E X-Received: by 2002:a62:f909:: with SMTP id o9-v6mr15576053pfh.141.1535718328155; Fri, 31 Aug 2018 05:25:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535718328; cv=none; d=google.com; s=arc-20160816; b=gcrPp7DfXfHUtUigdsC/e30LntSEn3xq0c9DjdN+LluJHv0NqQtJqRhKRCwmRq+way j45025bH360Gen1YBx6WNgEQFNQt2wAFLJ2ynjH4rgkvT/cwAl2slsMestnHQxqr73HL 0DfsgfKFL+tkoppz+XdPPPx2Y5tE1cu4zdrnztDqz89keQCUQEDKg+1+Nd6FaTCFwiFN vUZQLfW/LAJuiLoc17Ay2yls3piHus6E5//ZlNm7IoBNVEDlUPajHLUR2no2qhRJCIM4 hzhKAaFP2xAypG2/xktNR/1SOnRjIg+NeiOor1DO/ZHmbkccv9598H2U6WyIIlCpTwAF Sf3A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=NRy67uFMHQ07jmRD9fVBsxkOTnm1OvWO/sEiopWRIOE=; b=dq9fzG1AdG3LcvvjU4gTs6OSeHy5l2Rum04c4QTQYgjRQ9K14hiHq7bheQu+aLA7w2 U1k9mYs4kmgN5qIM+1wsiS7Om34EiRXRxuldgB7R3cDDFUnslBHTkCzVk9RL2DZVS/gG uSlf5eJK26e3NF82QwoqLbx66sV53hw7uBZXUXcTIGHlST6v5ZW9IckBoMDqON/g1co7 PnU4lsvL5zVLYVbl/M4uKb7N+0Ea6ja3jVdNT4y+jJHCoZ8H0xiTudqE6yTvDntjqU1y 7NbLsFDnSqIO1UrN5hELRcb0xSjptg8exJFjb06GO82pWIIQnMj/cWp/u7bblTUOIT9n +Mbg== 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 81-v6si9690501pgd.57.2018.08.31.05.25.12; Fri, 31 Aug 2018 05:25:28 -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 S1728349AbeHaQbU (ORCPT + 99 others); Fri, 31 Aug 2018 12:31:20 -0400 Received: from mail-wr1-f68.google.com ([209.85.221.68]:37330 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728014AbeHaQbU (ORCPT ); Fri, 31 Aug 2018 12:31:20 -0400 Received: by mail-wr1-f68.google.com with SMTP id u12-v6so11028148wrr.4 for ; Fri, 31 Aug 2018 05:24:03 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=NRy67uFMHQ07jmRD9fVBsxkOTnm1OvWO/sEiopWRIOE=; b=LP5EI18VgiC/u80KP45CjI+OZJIeIm17C+xBv5FjNjIrmXA7JqLOj5Rb5Xf+yWLV0Q Ork/M29lJEY6pBiRSLq03g3QV3sMy4M+h2x9kkJqCXsjlweCt62vk2LkHlSYZwie5dxK RGhiBbr6juGBlimsqyUEInWgtIX3SViG5996yZ7Y5cokIoWgnmnNOf+7a+EntTNQ5D63 il9WfP9kkvQbAgvCMhSTQl5DbsqC9QR8dxLRJGTzZNnXzN2UAJ3lWXQ7OP+5TPzKGFId Sh9WGdP9qEcNPSi9UF/20yjvQbquCWz56oS1g7SeBwPC5r9G0vhWVZXMdrSsgwFeoduS g6YQ== X-Gm-Message-State: APzg51AtfGovAOFyaC6Hxwd+geg5D2VyOCvo3nfz7bP7YI0SRXzRqrQ/ 08i96FIoFwTQ/am4qDjh0HY= X-Received: by 2002:adf:d245:: with SMTP id o5-v6mr10523813wri.91.1535718242859; Fri, 31 Aug 2018 05:24:02 -0700 (PDT) Received: from techadventures.net (techadventures.net. [62.201.165.239]) by smtp.gmail.com with ESMTPSA id v21-v6sm9682818wrd.4.2018.08.31.05.24.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 31 Aug 2018 05:24:02 -0700 (PDT) Received: by techadventures.net (Postfix, from userid 1000) id 4854A124D2A; Fri, 31 Aug 2018 14:24:01 +0200 (CEST) Date: Fri, 31 Aug 2018 14:24:01 +0200 From: Oscar Salvador To: Pasha Tatashin Cc: "akpm@linux-foundation.org" , "mhocko@suse.com" , "vbabka@suse.cz" , "sfr@canb.auug.org.au" , "iamjoonsoo.kim@lge.com" , "linux-mm@kvack.org" , "linux-kernel@vger.kernel.org" , Oscar Salvador Subject: Re: [PATCH] mm/page_alloc: Clean up check_for_memory Message-ID: <20180831122401.GA2123@techadventures.net> References: <20180828210158.4617-1-osalvador@techadventures.net> <332d9ea1-cdd0-6bb6-8e83-28af25096637@microsoft.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <332d9ea1-cdd0-6bb6-8e83-28af25096637@microsoft.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Aug 30, 2018 at 01:55:29AM +0000, Pasha Tatashin wrote: > I would re-write the above function like this: > static void check_for_memory(pg_data_t *pgdat, int nid) > { > enum zone_type zone_type; > > for (zone_type = 0; zone_type < ZONE_MOVABLE; zone_type++) { > if (populated_zone(&pgdat->node_zones[zone_type])) { > node_set_state(nid, zone_type <= ZONE_NORMAL ? > N_NORMAL_MEMORY: N_HIGH_MEMORY); > break; > } > } > } Hi Pavel, the above would not work fine. You set either N_NORMAL_MEMORY or N_HIGH_MEMORY, but a node can have both types of memory at the same time (on CONFIG_HIGHMEM systems). N_HIGH_MEMORY stands for regular or high memory while N_NORMAL_MEMORY stands only for regular memory, that is why we set it only in case the zone is <= ZONE_NORMAL. > zone_type <= ZONE_MOVABLE - 1 > is the same as: > zone_type < ZONE_MOVABLE This makes sense. -- Oscar Salvador SUSE L3