From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: passt.top; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: passt.top; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=T82eTVZx; dkim-atps=neutral Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by passt.top (Postfix) with ESMTPS id B89475A0271 for ; Tue, 09 Sep 2025 17:02:42 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1757430161; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=5d+eHfKP37A+X1dzdOPtZpaqgb0VoMqogFioFY22Kwo=; b=T82eTVZxMqq6uc2+C/cN4cRrBYg5WJXqvr6sN04b9L/E52PBapFGRpmFugAYDlfCShOKJx OHIDSfXl8D69/7UatcISDtK3E6J/wSTFc+BNpvx4jhO+XhM3/jijLg9klhoQDD878jX7T1 bdcL0fbG7l7gEfW09krfOFS1VFyG/os= Received: from mail-qv1-f69.google.com (mail-qv1-f69.google.com [209.85.219.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-128-9-Hre2dkPJq-OWl8Hmux9w-1; Tue, 09 Sep 2025 11:02:40 -0400 X-MC-Unique: 9-Hre2dkPJq-OWl8Hmux9w-1 X-Mimecast-MFC-AGG-ID: 9-Hre2dkPJq-OWl8Hmux9w_1757430160 Received: by mail-qv1-f69.google.com with SMTP id 6a1803df08f44-7296c012f6bso117145866d6.3 for ; Tue, 09 Sep 2025 08:02:40 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1757430160; x=1758034960; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=5d+eHfKP37A+X1dzdOPtZpaqgb0VoMqogFioFY22Kwo=; b=RLrMnTzj9q40/j+/VwaWa9olsvZP9HvDM3WTzTW3XqL2cchiS9pGVQy9O6/hmRczKX cUtg4RtVExgni9dYW/Fra3hbHarOf/HPJPdy8gNGrBKHjJIi9fEaJqJ5jtwGhNU8mT51 5w4hpAC3fG7JFPgAqg38Vfy7hRvf9Vb4KYO95drluOQF45LuiitBZ4Mw80NhqXMm3jFY o7jYePobdghK+zVRXLCJcOS8l4if4/Y2t5ooTt2/vodLt9sayc0Pdj30TrEd9DUgf0+R tYT/RjUVdhCMHF57CEiVhlZM/ONGs4wGRnMV/qs8Ol8koaJkoO6Fafl96Cho0sZZSkYD ZxUA== X-Forwarded-Encrypted: i=1; AJvYcCVZCugmynkY4OuFy9TF3vr4dg6bvAlmtb7rGErb1XO8HEGgiTrWV7e+xV43hMm15Sx1NrKD6zukGQE=@passt.top X-Gm-Message-State: AOJu0Yxboo5yiaowXcEZvVA1QmATtXABvZI8gbiEA3enAoi173uxUClp A/dCAJOh4LaxeM8xIvyV0rUmEO9wvnHj3VRM99e1fOv36VsAdCYGhK7eiw1AOm7ZaAg3mtV8weE nzVVaDM6kP4XwOwaIlSa6DTDrD3mmBsZ2QXNR4CUea03hy9bcU5zYMw== X-Gm-Gg: ASbGncstY/vzQTpckKhClBNnZgrk6GQlk+r7XZwwrUIcAz96mFdaE/eOP2Kgl+wiLte 5vQUogk2SQqFW+qJFW9UkRJq9+LVGgkEqq0Nskoqa0UVYgL583zsRbY+BdGHpcbNAyM2WHkNlck EJn2B9nEmM3ROXNLAjEqsQYMcyWA/y5kyo9SmmrMQIa4SQxDWUOHkDz/bCy4s1Hem5dVWCdSBDt sTz+/wQVedq242/R3lup+vBgb+OHAuJeUcc242Q6nZyJ/IaD5Emf9vn1VVc1HzKo+bq4A/uD/hC nfXvdsyv72q+JDOkt8MZ+Fe+srh9EdU9TlAiZVo6nCntzyBzY0YVX0FWd7A4sp9sHauw6zjDuSa F/LSsqXfbhQ== X-Received: by 2002:a05:6214:21e8:b0:72b:5e4d:d41e with SMTP id 6a1803df08f44-7393d4323b1mr116598336d6.60.1757430159539; Tue, 09 Sep 2025 08:02:39 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFOvund14OyGlFN0upTkP8w3qPU5VmYJVX0MVg4m70l0xhiwA2S7rSH+UgVygheLk8sJhJRyw== X-Received: by 2002:a05:6214:21e8:b0:72b:5e4d:d41e with SMTP id 6a1803df08f44-7393d4323b1mr116597626d6.60.1757430158451; Tue, 09 Sep 2025 08:02:38 -0700 (PDT) Received: from ?IPV6:2001:4958:2206:8901:6025:1483:4146:72dd? ([2001:4958:2206:8901:6025:1483:4146:72dd]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-720b46660fbsm145030436d6.44.2025.09.09.08.02.37 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 09 Sep 2025 08:02:37 -0700 (PDT) Message-ID: <491cd702-ddf6-4a9a-b44e-9385155266c5@redhat.com> Date: Tue, 9 Sep 2025 11:02:36 -0400 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v5 02/10] fwd: Added cache table for ARP/NDP contents To: David Gibson References: <20250906021154.2760611-1-jmaloy@redhat.com> <20250906021154.2760611-3-jmaloy@redhat.com> From: Jon Maloy In-Reply-To: X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: SUsWKSyEmEi2Y0_O6pF1HD9VoRpkx6MoHd9mj1IjEuk_1757430160 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Message-ID-Hash: Q2HUCAH6STZMZNVROEDT5EHBHQS5R44N X-Message-ID-Hash: Q2HUCAH6STZMZNVROEDT5EHBHQS5R44N X-MailFrom: jmaloy@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: sbrivio@redhat.com, dgibson@redhat.com, passt-dev@passt.top X-Mailman-Version: 3.3.8 Precedence: list List-Id: Development discussion and patches for passt Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: On 2025-09-07 22:42, David Gibson wrote: > On Fri, Sep 05, 2025 at 10:11:46PM -0400, Jon Maloy wrote: >> We add a cache table to keep partial contents of the kernel ARP/NDP [...] >> + return mac_undefined(e->mac); >> +} >> + >> +/** >> + * mac_entry_expired() - Check if a cache entry has expired >> + * @e: Cache entry >> + * >> + * Return: True if the entry has expired, false otherwise >> + */ >> +static bool mac_entry_expired(const struct mac_cache_entry *e) >> +{ >> + struct timespec now; >> + >> + clock_gettime(CLOCK_MONOTONIC, &now); > > Mostly we try to keep to a single clock_gettime() call per epoll > cycle, passing 'now' down to the things we call there. > >> + return timespec_before(&e->expiry, &now); >> +} Passing this value along the whole call chain just for the unlikely case that we may need it here seems like a bad idea, especially since the performance gain is minimal. It would make some sense if we add it to the context struct or even as a global variable the set it in the main loop, and pass it along that way. What do you think? ///jon