Received: by 10.213.65.68 with SMTP id h4csp1129323imn; Wed, 14 Mar 2018 10:25:23 -0700 (PDT) X-Google-Smtp-Source: AG47ELsMN5iBQxQ3MgK+KFCIlExwH2NsshA0eOACyJIqfh60OSlELVRsYiJypUp0CC+hAycd5uOe X-Received: by 10.101.88.76 with SMTP id s12mr2937112pgr.423.1521048322990; Wed, 14 Mar 2018 10:25:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521048322; cv=none; d=google.com; s=arc-20160816; b=trFE1+HC2IbgzCHME3Ec30JtYxu3+qjRsdX0B2w7SIg0tckoeKF4sWtwhV++A1SVlz T5OYB6pn9iVGmN5r663TWwDFmKLDW4WG2X6Q7+QNAWYDKdik8CbVndxhlfusj7OFFATO xc1vLkfMvdq5laMwZAO4zjQnABA9qfgZq9fKswgsV0SX6rLxkD2RtPzRrc8CKv49exYC s8VGluG0gMXrShsiqVpFaX7Nb2BmAlwsCuDk5YOFLQIvjFTrUGnuoCR5kCEPSsAjUN2K eaNexEZFSy5/LrN70AVeQYxkUjimpufn/dS6yct0VdXeuIe1ylX+mXZZxILFmKm7IfOm M+Yg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=BweOpCipN3yado/JieypDJwyRbZkKBIbYh4HZ3xPRiQ=; b=kZccNRdeAIMcOFbPprFhTUJ4SseB6Y9//bp4iUGSGQUCDwGHZYFEOUQCXjE6gJycAx WIFpMWfelrl2BttzjhXhR07I7b1+QT1jeoOsPzb/6vu0HxnXQUu73DnfrVVJvVp1vCxJ p3A2EqFLeJjsxe/P5NICURHmTuNWQTphjRSQPwDcAXodO1hpD5g1OKbwscEFU4qy623A dtRiQ8bOlXhXWqJAiHhBxdZBK+SA/T+DBbVDAwxZ0egdF7uVc4cMOJVqlx+E3OSlu6SZ 0vQ16uSm47stIWJI8c4HX088vfIU4aXwJBPzOMXzNKEOmNi7RF5YyD5Ta5hECHiDkydK +WnQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=aiHaIYZ4; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j15si2119666pgv.676.2018.03.14.10.25.08; Wed, 14 Mar 2018 10:25:22 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=aiHaIYZ4; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751555AbeCNRYR (ORCPT + 99 others); Wed, 14 Mar 2018 13:24:17 -0400 Received: from mail-qt0-f179.google.com ([209.85.216.179]:45521 "EHLO mail-qt0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750779AbeCNRYP (ORCPT ); Wed, 14 Mar 2018 13:24:15 -0400 Received: by mail-qt0-f179.google.com with SMTP id v90so4238821qte.12; Wed, 14 Mar 2018 10:24:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=BweOpCipN3yado/JieypDJwyRbZkKBIbYh4HZ3xPRiQ=; b=aiHaIYZ49UuprLs6R+eJEEwKUGlIqEj3EQiFHXGhgiRBTH0gg90kg0AOjMrxC7q7AO qRgijzVuYlk6/H/4aqm3WI92G/SO4NTpGTir+uerRPKSfliXe20U7/Iu4jbQbTJ0CWZZ LCVQIESocph6ShCJyrfcxm1e/JBh3TIdpgBPjeZmiITwn9qwNtmbzhL7s6YhWn6Turgr Ug10QK+EpoAD2zPEDlKvpWTe95XeHyBDPOJzBocjBHCzYjDsSsB25tdN+cytZLiSe4WJ p4E8sXd1YOrOwShZqu+Dm1HYljQS75IdPAIQDZ0Rz82ylps3OCGPslh2Yx3Jb4O5QLJP qiyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=BweOpCipN3yado/JieypDJwyRbZkKBIbYh4HZ3xPRiQ=; b=CTgNqRsJcqAYbx6VtXjvrzAo/BRyFb5RC3XBySK38JEMYVJatOUswblRfXBEyRqNKw VIlMzbzqGBnsbArZYBDhFzx86b0kI7iCIQbAn5WBdyDCrKCV74TrXapw5lmAhfG8HqhJ CXoLUkMo21FQlfhQ+Kkfup0C4J0S6hdS015hM+glsDWgYpNrFMkrVbjWqjOnI9mlPEaG TVx83vUbjYY2LoPq8QU5awv/JFcjtusP3pb7l7kU9ngzbvsXypoTextJxP6O4d/7e8E/ jFTfEj6n00bCuBWtYY/QsQABLiAOe53ZMJx3B7NSB+rcjuEsatq9d8lbBNhNJ72lXu88 +DVQ== X-Gm-Message-State: AElRT7GNSHWIJSXBQ1YawSF0GJK+1CjuwejaesgneDmJndwkY/Ihchv6 +oGvaKeGJHIHBoJimVwimIkvR3PSMBPmCFERmSEO/AlDUZQ= X-Received: by 10.200.25.20 with SMTP id t20mr8484794qtj.187.1521048254524; Wed, 14 Mar 2018 10:24:14 -0700 (PDT) MIME-Version: 1.0 Received: by 10.12.195.80 with HTTP; Wed, 14 Mar 2018 10:24:14 -0700 (PDT) In-Reply-To: <20180314102847.30459-1-douly.fnst@cn.fujitsu.com> References: <20180314102847.30459-1-douly.fnst@cn.fujitsu.com> From: Andy Shevchenko Date: Wed, 14 Mar 2018 19:24:14 +0200 Message-ID: Subject: Re: [RFC PATCH] ACPI / processor: Get accurate possible CPU count To: Dou Liyang Cc: ACPI Devel Maling List , Linux Kernel Mailing List , "Rafael J. Wysocki" , Len Brown , Thomas Gleixner , "Rafael J. Wysocki" , Artem Bityutskiy , ming.lei@redhat.com 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 On Wed, Mar 14, 2018 at 12:28 PM, Dou Liyang wrote: > +static void __init acpi_update_possible_map(void) > +{ > + unsigned int cpu, nr = 0; > + > + if (nr_cpu_ids <= nr_unique_ids) > + return; > + > + for_each_possible_cpu(cpu) { > + if (nr >= nr_unique_ids) > + set_cpu_possible(cpu, false); > + nr++; > + } IIUC this can be optimized to: if (nr_unique_ids >= nr_cpu_ids) return; /* Don't yet figure out if it's superfluous */ if (nr_unique_ids >= cpumask_last(cpu_possible_mask)) return; for_each_cpu_wrap(cpu, cpu_possible_mask, nr_unique_ids) set_cpu_possible(cpu, false); > + nr_cpu_ids = nr_unique_ids; > + pr_info("Allowing %d possible CPUs\n", nr_cpu_ids); > +} -- With Best Regards, Andy Shevchenko