public inbox for linux-pci@vger.kernel.org
 help / color / mirror / Atom feed
From: Bjorn Helgaas <helgaas@kernel.org>
To: Guixin Liu <kanie@linux.alibaba.com>
Cc: bhelgaas@google.com, linux-pci@vger.kernel.org,
	Greg KH <gregkh@linuxfoundation.org>
Subject: Re: [PATCH] PCI: optimize proc sequential file read
Date: Tue, 22 Oct 2024 10:44:43 -0500	[thread overview]
Message-ID: <20241022154443.GA880326@bhelgaas> (raw)
In-Reply-To: <20241018054728.116519-1-kanie@linux.alibaba.com>

[+cc Greg]

On Fri, Oct 18, 2024 at 01:47:28PM +0800, Guixin Liu wrote:
> PCI driver will traverse pci device list in pci_seq_start in every
> sequential file reading, use xarry to store all pci devices to
> accelerate finding the start.

>  /* iterator */
>  static void *pci_seq_start(struct seq_file *m, loff_t *pos)
>  {
> -	struct pci_dev *dev = NULL;
> +	struct pci_dev *dev;
>  	loff_t n = *pos;
>  
> -	for_each_pci_dev(dev) {
> -		if (!n--)
> -			break;
> -	}

Maybe another approach would be to use pci_get_device() directly
instead of for_each_pci_dev().

pci_get_device() takes a "from" starting point, so instead of keeping
track of the index "n", you could keep track of the current pci_dev.

  parent reply	other threads:[~2024-10-22 15:44 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-18  5:47 [PATCH] PCI: optimize proc sequential file read Guixin Liu
2024-10-18 22:22 ` Bjorn Helgaas
2024-10-21  2:04   ` Guixin Liu
2024-10-21 11:04     ` Greg KH
2024-10-22  2:21       ` Guixin Liu
2024-10-19  6:39 ` kernel test robot
2024-10-19 18:41 ` kernel test robot
2024-10-20  7:04 ` kernel test robot
2024-10-21  7:17 ` Dan Carpenter
2024-10-22  1:54   ` Guixin Liu
2024-10-22 15:44 ` Bjorn Helgaas [this message]
2024-10-24  3:42   ` Guixin Liu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241022154443.GA880326@bhelgaas \
    --to=helgaas@kernel.org \
    --cc=bhelgaas@google.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=kanie@linux.alibaba.com \
    --cc=linux-pci@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox