public inbox for linux-pci@vger.kernel.org
 help / color / mirror / Atom feed
From: Guixin Liu <kanie@linux.alibaba.com>
To: Bjorn Helgaas <helgaas@kernel.org>
Cc: bhelgaas@google.com, linux-pci@vger.kernel.org,
	Greg KH <gregkh@linuxfoundation.org>
Subject: Re: [PATCH] PCI: optimize proc sequential file read
Date: Thu, 24 Oct 2024 11:42:33 +0800	[thread overview]
Message-ID: <ac47e477-bb06-414f-9766-a3688c098beb@linux.alibaba.com> (raw)
In-Reply-To: <20241022154443.GA880326@bhelgaas>


在 2024/10/22 23:44, Bjorn Helgaas 写道:
> [+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.

You mean let struct seq_file to keep the pci_dev? Well, we also need keep

the pci_dev which held by seq_file in klist_devices, because finding 
next rely on

it, this make things complicated.

In addition, in pci_seq_start(), the pos may not increased one by one, so

we dont know how many times we should skip to find the pci_dev which number

is *pos.

Best Regards,

Guixin Liu


      reply	other threads:[~2024-10-24  3:42 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
2024-10-24  3:42   ` Guixin Liu [this message]

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=ac47e477-bb06-414f-9766-a3688c098beb@linux.alibaba.com \
    --to=kanie@linux.alibaba.com \
    --cc=bhelgaas@google.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=helgaas@kernel.org \
    --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