Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp2581813rwb; Mon, 15 Aug 2022 07:47:51 -0700 (PDT) X-Google-Smtp-Source: AA6agR7RGU6cWxxQaVNIux+o+81c4V5ZlwQc4nZHBXaIShpZwwzKmYgIulKoB+3wrzwavYcrcIwN X-Received: by 2002:a17:90b:3e8b:b0:1f5:2a52:9148 with SMTP id rj11-20020a17090b3e8b00b001f52a529148mr18367105pjb.175.1660574871004; Mon, 15 Aug 2022 07:47:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660574870; cv=none; d=google.com; s=arc-20160816; b=I32FIQexZfKhfX2yMDc4CvHibHz7tpn1WAwARgV8oYHKNs0I0a4pMlco5ZWFejMp9R mDGih23bmL61sRGXujpDncsXBvCv7VnszCydZjoa8+zux+PWn4oo4fm2fVqt/qslg8eI E2hFsW8k3UJ5YEKWTiIIHETKUV2Y5WKlc0zKNvKeuyidiVQY6ikljj4YjJu7Sejzo7F9 hGsIFUzGSP3mh9pYrpxUeIi0FqIZwh6QiPt5KOSDLTXpUn++HLGqXLxPRP8t3AjhQFx2 PQ+bmEl3CuNIiVl5Toaf+9YEggUKe+onAY76jNg1bbWz9526J62OYN57zl2xhesUC3mj k3yA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:dkim-signature; bh=sEuTlIc9D6exXishpGuOUy0Zpyin7rcQK73GQnhVdPw=; b=nXAKowXYbGSkbubjCHEtfu0v/QvDpnlv0yVgvkB37QAtdKLoBppPZU46u2zfn6jo8f sejvaf3vsVBtOaxY/+OFy01s+oX9DNmqEZxvPEEpiIa4v8kyLHkadmjoRqcyXwsCTLwS +iJXOdRnjO754tbc/3gFyOImto2Gh9l5b/lXZd2ulsYBbqS9smTfC0zAAwA7En6oUWRk XBY/cTHqrIuAFwPcr3BuO8lwNFbLZmK/hszya9OJpvNC1+y7xxKKBauW6mb3bR0BVcUj 6M1EF3cdO2nBjjxyj/oWWO+bKDN0+fnVQZ+/kHWnk+gNcqAX9nQRkd7tBgh81m2bv2Xd PXLQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=eFFDdc2Q; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q1-20020a170902dac100b001637dbe1bc4si11972631plx.44.2022.08.15.07.47.39; Mon, 15 Aug 2022 07:47:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=eFFDdc2Q; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242993AbiHOOU6 (ORCPT + 99 others); Mon, 15 Aug 2022 10:20:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33404 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243009AbiHOOUv (ORCPT ); Mon, 15 Aug 2022 10:20:51 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id D04EC647F for ; Mon, 15 Aug 2022 07:20:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1660573250; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=sEuTlIc9D6exXishpGuOUy0Zpyin7rcQK73GQnhVdPw=; b=eFFDdc2QOIDyvBLbuL3+YvDRXLArchFfiHNSCrM9E5BP2UprZssp3EDfK3ErTYKw6Xu5QE 8FF0Tqw7LelSJ8l5WYjRZwBaLl/2CSgQi25JX04nQMqT6S5V3i3tcYdHi/b97pdkKJcBHp GPfj6KYDzf2YSpDY/7meU95x5PEt7wE= Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-214-oOWlM7hqMeWV7Dhw1ZiifQ-1; Mon, 15 Aug 2022 10:20:41 -0400 X-MC-Unique: oOWlM7hqMeWV7Dhw1ZiifQ-1 Received: by mail-wr1-f70.google.com with SMTP id v20-20020adf8b54000000b002216d3e3d5dso1235371wra.12 for ; Mon, 15 Aug 2022 07:20:40 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:x-gm-message-state:from:to:cc; bh=sEuTlIc9D6exXishpGuOUy0Zpyin7rcQK73GQnhVdPw=; b=oipsOn3Frl9IbgBp3dbc9J+gwHmiBhPQcTRcKSEWgaHBvwEAyptgjrjX7AfZ+aRNOp 6a9HtCzlFy/CUm25T+kYg6O11De79yjAKabk5Nmr33whIm5AWOZIKDcr2u0QWm/KcPyA MzvkXPR9EReoQF41SSDoOkqTQkcBw2bHlAO3b1+/g1CEMHyrEoRDU5rTfdcKJPXLjLKE CtvJbVea4TGIV2Bfpt7my225JjLV1/TZSGjivhPs2kAnSLbGkb4MYeCmcA+2XevpKSIm R6OBypftSSWr/O5rAsZnEVbVZTAs0QooVPlgX64F9Aq2n2vwgewMVuBcASyQbxtjxXQ1 rgDw== X-Gm-Message-State: ACgBeo0os4gK1TbMRumLpo5wQVFsVkJczG7XKrsTyQ5v0elDKCMkLR/l wWFGmVa0wg895LHjqWRIOoFbH8u/TdvTPr7DWn7tUaTzyU6iD7/k6Kgqdv+jLQhjcEA0XMpw+Bt xFJu8LM6ud0fi4EB3W5VlPX+g X-Received: by 2002:a7b:c851:0:b0:3a5:f211:45cd with SMTP id c17-20020a7bc851000000b003a5f21145cdmr3809014wml.156.1660573240050; Mon, 15 Aug 2022 07:20:40 -0700 (PDT) X-Received: by 2002:a7b:c851:0:b0:3a5:f211:45cd with SMTP id c17-20020a7bc851000000b003a5f21145cdmr3809000wml.156.1660573239855; Mon, 15 Aug 2022 07:20:39 -0700 (PDT) Received: from vschneid.remote.csb ([185.11.37.247]) by smtp.gmail.com with ESMTPSA id d15-20020a05600c048f00b003a601a1c2f7sm879909wme.19.2022.08.15.07.20.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Aug 2022 07:20:39 -0700 (PDT) From: Valentin Schneider To: Tariq Toukan , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Tariq Toukan , "David S. Miller" , Saeed Mahameed , Jakub Kicinski , Ingo Molnar , Peter Zijlstra , Juri Lelli , Eric Dumazet , Paolo Abeni , Gal Pressman , Vincent Guittot Subject: Re: [PATCH 1/2] sched/topology: Introduce sched_numa_hop_mask() In-Reply-To: <6a2dae6d-cbac-84ba-8852-dadd183fb77d@gmail.com> References: <20220810105119.2684079-1-vschneid@redhat.com> <03aaf512-3ac5-fdfe-da2d-3fecd24591e2@gmail.com> <6a2dae6d-cbac-84ba-8852-dadd183fb77d@gmail.com> Date: Mon, 15 Aug 2022 15:20:38 +0100 Message-ID: MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 14/08/22 11:19, Tariq Toukan wrote: > The API is indeed easy to use, the driver part looks straight forward. > > I appreciate the tricks you used to make it work! > However, the implementation is relatively complicated, not easy to read > or understand, and touches several files. I do understand what you did > here, but I guess not all respective maintainers will like it. Let's see. > Dumping it all into a single diff also doesn't help :-) I think the changes to get a for_each_cpu_andnot() are straightforward enough, the one eyesore is the macro but I consider it a necessary evil to get an allocation-free interface. > One alternative to consider, that will simplify things up, is switching > back to returning an array of cpus, ordered by their distance, up to a > provided argument 'npus'. > This way, you will iterate over sched_numa_hop_mask() internally, easily > maintaining the cpumask diffs between two hops, without the need of > making it on-the-fly as part an an exposed for-loop macro. > That requires extra storage however: at the very least the array, and a temp cpumask to remember already-visited CPUs (the alternative being scanning the array every CPU iteration to figure out if it's been added already). I'm going to submit the cpumask / sched changes, hopefully I get to something by the time you're back from PTO.