From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-qt1-x831.google.com (mail-qt1-x831.google.com [IPv6:2607:f8b0:4864:20::831]) by sourceware.org (Postfix) with ESMTPS id 6809A3846403 for ; Thu, 6 May 2021 20:07:05 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 6809A3846403 Received: by mail-qt1-x831.google.com with SMTP id j11so4995634qtn.12 for ; Thu, 06 May 2021 13:07:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=+fuHX76KCisEZK5AOuewdiTByCux5fp57H1DO9b3KT0=; b=jhJ1KGkMu9Slz2/oneZMd9uIv6JXysT4P2q0v5YQ07vHHh96n9QZLjiFCj6hcHMaJ1 /VIlE1bSO68BiUlNJeElI8bslYeZUHJMVz831potOFCjQbSWGeZ7ndgke0rHAaMUjFUh 7VfiUlSAF+Mc2jnGqVMr2rF14LnPS6Js3WbOrrycPAbOjSW3QiaOhjLA3BcuOVYrnO41 1lWHqEU9yzanRwahFtu/+KFro4yhawIqU6OQnLlOa6ApM9gcHxVK1SuYg+m87vfCYqeo MSivU9bFay3eb6vFHg29B8PhTGabn5yx2Pe+lkWDfRj2UDD1MEpuPh0MC21xLZdbZBsx OGVA== X-Gm-Message-State: AOAM531Uy/0CayxuLFGo4i7Ot95mbxsrMaCzJ0gaftybpGHPAAvuEv3j 636R8ZPrXI/G+kZR9sXf43VOQQ== X-Google-Smtp-Source: ABdhPJy4wWysb4eSpPmy3jdgFRFOVXkD+HwyaUG0McBNithejq7quDKgBBixkKbBm+qdvgvXdZX2WA== X-Received: by 2002:ac8:6c3a:: with SMTP id k26mr6488242qtu.146.1620331625000; Thu, 06 May 2021 13:07:05 -0700 (PDT) Received: from [192.168.1.4] ([177.194.37.86]) by smtp.gmail.com with ESMTPSA id f26sm3106185qtg.17.2021.05.06.13.07.03 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 06 May 2021 13:07:04 -0700 (PDT) Subject: Re: [PATCH 3/4] linux: Use /sys/devices/system/cpu/possible on __get_nprocs_conf To: Florian Weimer , Adhemerval Zanella via Libc-alpha Cc: crrodriguez@opensuse.org References: <20210329182520.323665-1-adhemerval.zanella@linaro.org> <20210329182520.323665-3-adhemerval.zanella@linaro.org> <871ralcbha.fsf@oldenburg.str.redhat.com> <87sg31awd8.fsf@oldenburg.str.redhat.com> <87h7jggec3.fsf@oldenburg.str.redhat.com> From: Adhemerval Zanella Message-ID: <0b31aafd-b73b-fa82-ac1b-da04f8c68698@linaro.org> Date: Thu, 6 May 2021 17:07:02 -0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 MIME-Version: 1.0 In-Reply-To: <87h7jggec3.fsf@oldenburg.str.redhat.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-6.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 May 2021 20:07:07 -0000 On 06/05/2021 10:51, Florian Weimer wrote: > * Adhemerval Zanella via Libc-alpha: > >> On 05/05/2021 15:06, Florian Weimer wrote: >>> * Florian Weimer: >>> >>>> * Adhemerval Zanella via Libc-alpha: >>>> >>>>> + /* The entry is in the form of '[cpuX]-[cpuY]'. */ >>>>> + char buf[2 * INT_STRLEN_BOUND (unsigned int) + 1]; >>>>> + >>>>> + ssize_t n = __read_nocancel (fd, buf, sizeof (buf)); >>>>> + if (n > 0) >>>>> + { >>>>> + buf[n] = '\0'; >>>>> + >>>>> + /* Start on the right, to find highest node number. */ >>>>> + int m = 1; >>>>> + while (--n) >>>>> + { >>>>> + if ((buf[n] == ',') || (buf[n] == '-')) >>>>> + break; >>>>> + /* Ignore '\n' */ >>>>> + if (! isdigit (buf[n])) >>>>> + continue; >>>>> + result += (buf[n] - '0') * m; >>>>> + m *= 10; >>>>> + } >>>>> + } >>>>> + >>>>> + __close_nocancel (fd); >>>>> + return result + 1; >>>>> } >>>> >>>> I think the /online and /possible files have the same layout, so you >>>> could use both. >>> >>> Sorry, I meant to write: “so you could use *one parser for* both” >> >> I am not following, the second patch in this set *removed* the >> /sys/devices/system/cpu/online parsing in favor of the sched_getaffinity. >> So now it only parses /sys/devices/system/cpu/possible and fallbacks >> to sched_getaffinity. > > Oh, right. So you removed the old implementation and bring bug a > slightly different new one. Got it. Right, are you ok with the patch then?