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 X-Spam-Level: X-Spam-Status: No, score=-0.5 required=3.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6D16FC433DB for ; Thu, 18 Mar 2021 15:48:34 +0000 (UTC) Received: from shelob.surriel.com (shelob.surriel.com [96.67.55.147]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E2E0C64EF2 for ; Thu, 18 Mar 2021 15:48:33 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E2E0C64EF2 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kernelnewbies-bounces@kernelnewbies.org Received: from localhost ([::1] helo=shelob.surriel.com) by shelob.surriel.com with esmtp (Exim 4.94) (envelope-from ) id 1lMusi-0007m6-Oo; Thu, 18 Mar 2021 11:48:16 -0400 Received: from mail-pj1-x102c.google.com ([2607:f8b0:4864:20::102c]) by shelob.surriel.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94) (envelope-from ) id 1lMush-0007m1-FD for kernelnewbies@kernelnewbies.org; Thu, 18 Mar 2021 11:48:15 -0400 Received: by mail-pj1-x102c.google.com with SMTP id gb6so3160333pjb.0 for ; Thu, 18 Mar 2021 08:48:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=references:user-agent:from:to:cc:subject:date:in-reply-to :message-id:mime-version; bh=lbeYmW4OioS1qgFvQHINcVlbCs90e7OvZ+VY4Sw9ZIQ=; b=XAzBM665/VtrLrrEEsAQRsHeAvr6pTgL2aGVF9p28s2XKXJ51wpZnfX+DJsP2aJyKE hwmICXd9IXTddvjL/dmPShsPqy/HvjZkFdZ0z1kXMAyffqUfz9/EE65WZVqxC5VvflYZ oLQioeBOjLDzb6fTt+6OUpQrMiWnOyetwjT0zQsUrSGAgRflBGg65DEu4TMt/LKlIdG7 mJxWEZRk54pNqHKuVZ5ZnF51nLT02x9OnW+zXqwg9l871DuXWpZ43vMwDEbOWwDejv2J XmjsHDmEtj0aBwa2RDJMefKZUFrrCXsanXI8EVSvRQsOzqs4JygmJEPtm+9eufr8Mqq5 HBOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:references:user-agent:from:to:cc:subject:date :in-reply-to:message-id:mime-version; bh=lbeYmW4OioS1qgFvQHINcVlbCs90e7OvZ+VY4Sw9ZIQ=; b=quTiDSQNkQyNwdF4uOXZC/2I4jjb4dfl0VfMqlyfA1umEn9GY/sB4A0AAQZs0rnSB7 ipCmlFA+wH/4/+dY8gTQQa84lwIBfDmjfOAYwkW4MR1Dzowk7j55sjCFa+JreSTyn86Q QZThUQ2/CnLjGAngnhGh0Mx72198mF3A5enYAKC/aqWlQr748zuYvH4uQkg2NyhqUxNq XRcCVmgKK1oQFyBkexZdl4uUFD99Bd7nGSKbJNoxc+ZkKpl1yyGWr8QRs+QIr75tU+Q8 QcOTCvEqOkcslgdoclJG1UgglpGvI2N+gWB/bUjmkqDohCJM2EUEuh1jNFy0OBtv2g9h vmxA== X-Gm-Message-State: AOAM530iSM8YW5tKFj7bZxn8/HLTh4fXvske0fXPyPAjH5gdqA+XOCnd oI4QXJOUfEpzNhITHqguAtty1QV1td4= X-Google-Smtp-Source: ABdhPJx9p/+yOiv/mIKpHz2if1WyJ/Gp6Vl21K+G3i8sslK13cR1iYUVCqGzjGQ/xRrYzMELbMqRYg== X-Received: by 2002:a17:90b:798:: with SMTP id l24mr4818617pjz.63.1616082494228; Thu, 18 Mar 2021 08:48:14 -0700 (PDT) Received: from pop-os ([1.234.154.110]) by smtp.gmail.com with ESMTPSA id q205sm3086398pfc.126.2021.03.18.08.48.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Mar 2021 08:48:13 -0700 (PDT) References: <87a6r01pfs.fsf@gmail.com> User-agent: mu4e 1.5.7; emacs 28.0.50 From: Junyeong Jeong To: Greg KH Subject: Re: /sys/devices/system/cpu/possible is immutable? Date: Fri, 19 Mar 2021 00:45:07 +0900 In-reply-to: Message-ID: <877dm41n0k.fsf@gmail.com> MIME-Version: 1.0 Cc: kernelnewbies@kernelnewbies.org X-BeenThere: kernelnewbies@kernelnewbies.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Learn about the Linux kernel List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: kernelnewbies-bounces@kernelnewbies.org > > That sysfs value itself will not change for the single system while the > kernel is running, but your program could be moved from a system with > one value for that file, to another system with a different value while > it is running without knowing that you were migrated. > Running process migration to another system? Wow, I never knew that. If migration happens between the time of reading /sys/devices/system/cpu/possible and the time of calling `bpf_lookup_elem`, TOCTOU(Time of check to Time of Use) problem would arise. HaHa. > So be careful here, and use the "normal" api to deal with cpu values and > numbers, never assume that once you start, that the number of cpus your > program has access to will not change. Thank you Kroah-Hartman for your advice. regards, Junyeong _______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies