Prev: WinUSB Error 121 - semaphore timeout
Next: STATUS_ACCESS_DENIED causes file deletion (minifilter driver)
From: Alexander Grigoriev on 7 Jan 2010 23:10 Considering that all new computers are x64 compatible, with memory >=2GB, and most OEMs are shipping x64 flavor installed by default, this exercise can be compared to collecting drops from liquor bottles for a morning hangover fix... Not that I ever did that... "Pavel Lebedinsky [MSFT]" <pavel(a)online.microsoft.com> wrote in message news:OwmRwS2jKHA.2132(a)TK2MSFTNGP05.phx.gbl... >> I would call this micro-optimization, rudiment from NT 3.1, which ran >> on 32 MB. I don't argue against paged pool, but paged kernel code >> should just go away. And paged kernel stacks, too > > If you ask the Windows perf team, they will probably say that > saving 10 MB of nonpaged memory is a major achievement, not a > micro-optimization. > > During win7 the perf team filed hundreds of bugs against all kinds > of components across Windows (not just drivers), asking them to > reduce nonpaged footprint, copy-on-write pages in user space etc. > Sometimes the savings were just a few pages per component, > but together they are a big part of why win7 is the only version > of Windows (except maybe NT 3.5/3.51) to have a smaller > memory footprint than the previous one. > >> Better memory usage optimization would be to fix file caching. > > That's like saying that you shouldn't try to make a plane lighter > until you can figure out how to make the engines more powerful. > Why not try to do both at the same time? > > -- > Pavel Lebedinsky/Windows Fundamentals Test > This posting is provided "AS IS" with no warranties, and confers no > rights. >
From: Don Burn on 8 Jan 2010 08:29 No the exercise is called responsible driver writting. I have faced with a bunch of drivers that were poorly written and take much more non-paged code than they needed to. It is amazing how little work it took once I got the source to reduce one drivers foot print by 50%. There will be 32-bit systems for a long time, there will be a lot of 64-bit systems with low end memory systems which limit memory to something small for a much longer time. -- Don Burn (MVP, Windows DKD) Windows Filesystem and Driver Consulting Website: http://www.windrvr.com Blog: http://msmvps.com/blogs/WinDrvr Remove StopSpam to reply "Alexander Grigoriev" <alegr(a)earthlink.net> wrote in message news:%23C7XTiBkKHA.4356(a)TK2MSFTNGP06.phx.gbl... > Considering that all new computers are x64 compatible, with memory >=2GB, > and most OEMs are shipping x64 flavor installed by default, this exercise > can be compared to collecting drops from liquor bottles for a morning > hangover fix... Not that I ever did that... > > "Pavel Lebedinsky [MSFT]" <pavel(a)online.microsoft.com> wrote in message > news:OwmRwS2jKHA.2132(a)TK2MSFTNGP05.phx.gbl... >>> I would call this micro-optimization, rudiment from NT 3.1, which ran >>> on 32 MB. I don't argue against paged pool, but paged kernel code >>> should just go away. And paged kernel stacks, too >> >> If you ask the Windows perf team, they will probably say that >> saving 10 MB of nonpaged memory is a major achievement, not a >> micro-optimization. >> >> During win7 the perf team filed hundreds of bugs against all kinds >> of components across Windows (not just drivers), asking them to >> reduce nonpaged footprint, copy-on-write pages in user space etc. >> Sometimes the savings were just a few pages per component, >> but together they are a big part of why win7 is the only version >> of Windows (except maybe NT 3.5/3.51) to have a smaller >> memory footprint than the previous one. >> >>> Better memory usage optimization would be to fix file caching. >> >> That's like saying that you shouldn't try to make a plane lighter >> until you can figure out how to make the engines more powerful. >> Why not try to do both at the same time? >> >> -- >> Pavel Lebedinsky/Windows Fundamentals Test >> This posting is provided "AS IS" with no warranties, and confers no >> rights. >> > > > > __________ Information from ESET NOD32 Antivirus, version of virus > signature database 4753 (20100108) __________ > > The message was checked by ESET NOD32 Antivirus. > > http://www.eset.com > > > __________ Information from ESET NOD32 Antivirus, version of virus signature database 4753 (20100108) __________ The message was checked by ESET NOD32 Antivirus. http://www.eset.com
From: alberto on 8 Jan 2010 12:50 I frankly don't see what's the point. If there's not enough space for drivers to comfortably use the nonpaged pool for what they need - without having developers to exercise what I'd call "dirty" optimization and handicrafted embellishment - then the OS may need to be revamped, or we may need a bigger machine, or both. There's also the issue that no matter how we hack it, 32-bit systems are limited in what they can handle, and, true enough, by the time the NP pool runs out of space we may have hit a bottleneck way before. Given that it is already complicated enough to write a driver, I believe that bothering about substituting paged for nonpaged memory only adds to the complexity - and consequently to the potential instability - of the code. There are more important things that require our developer's creative juices. I agree with Alexander that drivers should not use paged storage, period. If the OS cannot handle that, let's improve the OS. One other point that may not be relevant to many of you but that is quite relevant to me is the compatibility issue. I just cannot afford to let nonportable mechanisms to infiltrate my driver, or I'm going to have a hard time running it on a non-Windows OS. I need a memory utilization model that is eminently portable between Windows and the Unixen, else I'm not going to use it! Last but not least, "responsible" driver writing is at the eyes of the beholder. In my line of work, for example, not making strong use of the system's capabilities to optimize its main mission is not what I would call "responsible". In fact, to avoid this kind of problem, I allocate a pretty large chunk of physical memory at init time - hundreds of megabytes if I can - and I suballocate my memory from there, and chuck the NP pool. When push comes to shove and what I need is to make sure that the main mission of the system gets accomplished, I'm not at all shy of taking control of things in my own hands, and I call that as "responsible" as it can be - my users come first, the OS second. But hey, I may be wrong. Alberto. On Jan 8, 8:29 am, "Don Burn" <b...(a)stopspam.windrvr.com> wrote: > No the exercise is called responsible driver writting. I have faced with a > bunch of drivers that were poorly written and take much more non-paged code > than they needed to. It is amazing how little work it took once I got the > source to reduce one drivers foot print by 50%. There will be 32-bit > systems for a long time, there will be a lot of 64-bit systems with low end > memory systems which limit memory to something small for a much longer time. > > -- > Don Burn (MVP, Windows DKD) > Windows Filesystem and Driver Consulting > Website:http://www.windrvr.com > Blog:http://msmvps.com/blogs/WinDrvr > Remove StopSpam to reply > > "Alexander Grigoriev" <al...(a)earthlink.net> wrote in message > > news:%23C7XTiBkKHA.4356(a)TK2MSFTNGP06.phx.gbl... > > > > > > > Considering that all new computers are x64 compatible, with memory >=2GB, > > and most OEMs are shipping x64 flavor installed by default, this exercise > > can be compared to collecting drops from liquor bottles for a morning > > hangover fix... Not that I ever did that... > > > "Pavel Lebedinsky [MSFT]" <pa...(a)online.microsoft.com> wrote in message > >news:OwmRwS2jKHA.2132(a)TK2MSFTNGP05.phx.gbl... > >>> I would call this micro-optimization, rudiment from NT 3.1, which ran > >>> on 32 MB. I don't argue against paged pool, but paged kernel code > >>> should just go away. And paged kernel stacks, too > > >> If you ask the Windows perf team, they will probably say that > >> saving 10 MB of nonpaged memory is a major achievement, not a > >> micro-optimization. > > >> During win7 the perf team filed hundreds of bugs against all kinds > >> of components across Windows (not just drivers), asking them to > >> reduce nonpaged footprint, copy-on-write pages in user space etc. > >> Sometimes the savings were just a few pages per component, > >> but together they are a big part of why win7 is the only version > >> of Windows (except maybe NT 3.5/3.51) to have a smaller > >> memory footprint than the previous one. > > >>> Better memory usage optimization would be to fix file caching. > > >> That's like saying that you shouldn't try to make a plane lighter > >> until you can figure out how to make the engines more powerful. > >> Why not try to do both at the same time? > > >> -- > >> Pavel Lebedinsky/Windows Fundamentals Test > >> This posting is provided "AS IS" with no warranties, and confers no > >> rights. > > > __________ Information from ESET NOD32 Antivirus, version of virus > > signature database 4753 (20100108) __________ > > > The message was checked by ESET NOD32 Antivirus. > > >http://www.eset.com > > __________ Information from ESET NOD32 Antivirus, version of virus signature database 4753 (20100108) __________ > > The message was checked by ESET NOD32 Antivirus. > > http://www.eset.com- Hide quoted text - > > - Show quoted text -
From: Don Burn on 8 Jan 2010 13:17 Gee, it is SO HARD to take a look at call and see if it is called only at PASSIVE_LEVEL and does not use something like spin locks that raise IRQL. And then of course once you add the #pragma page and a PAGED_CODE macro into the driver, it is INCREDIBLY HARD to run PreFast to find out if there is either a likelyhood the call is not a PASSIVE or that you are using an IRQL raising function. And of course it is CLOSE TO IMPOSSIBLE to run the checked version of the driver, and if by chance the analysis was wrong catch things when the PAGED_CODE macro asserts. Personally, I find it IMPOSSIBLE TO UNDERSTAND how people can be so lazy to not develop the code correctly. -- Don Burn (MVP, Windows DKD) Windows Filesystem and Driver Consulting Website: http://www.windrvr.com Blog: http://msmvps.com/blogs/WinDrvr Remove StopSpam to reply "alberto" <amoreira(a)ieee.org> wrote in message news:42d9806e-1f8e-4d1d-ba54-527f2f946a44(a)e20g2000vbb.googlegroups.com... I frankly don't see what's the point. If there's not enough space for drivers to comfortably use the nonpaged pool for what they need - without having developers to exercise what I'd call "dirty" optimization and handicrafted embellishment - then the OS may need to be revamped, or we may need a bigger machine, or both. There's also the issue that no matter how we hack it, 32-bit systems are limited in what they can handle, and, true enough, by the time the NP pool runs out of space we may have hit a bottleneck way before. Given that it is already complicated enough to write a driver, I believe that bothering about substituting paged for nonpaged memory only adds to the complexity - and consequently to the potential instability - of the code. There are more important things that require our developer's creative juices. I agree with Alexander that drivers should not use paged storage, period. If the OS cannot handle that, let's improve the OS. One other point that may not be relevant to many of you but that is quite relevant to me is the compatibility issue. I just cannot afford to let nonportable mechanisms to infiltrate my driver, or I'm going to have a hard time running it on a non-Windows OS. I need a memory utilization model that is eminently portable between Windows and the Unixen, else I'm not going to use it! Last but not least, "responsible" driver writing is at the eyes of the beholder. In my line of work, for example, not making strong use of the system's capabilities to optimize its main mission is not what I would call "responsible". In fact, to avoid this kind of problem, I allocate a pretty large chunk of physical memory at init time - hundreds of megabytes if I can - and I suballocate my memory from there, and chuck the NP pool. When push comes to shove and what I need is to make sure that the main mission of the system gets accomplished, I'm not at all shy of taking control of things in my own hands, and I call that as "responsible" as it can be - my users come first, the OS second. But hey, I may be wrong. Alberto. On Jan 8, 8:29 am, "Don Burn" <b...(a)stopspam.windrvr.com> wrote: > No the exercise is called responsible driver writting. I have faced with a > bunch of drivers that were poorly written and take much more non-paged > code > than they needed to. It is amazing how little work it took once I got the > source to reduce one drivers foot print by 50%. There will be 32-bit > systems for a long time, there will be a lot of 64-bit systems with low > end > memory systems which limit memory to something small for a much longer > time. > > -- > Don Burn (MVP, Windows DKD) > Windows Filesystem and Driver Consulting > Website:http://www.windrvr.com > Blog:http://msmvps.com/blogs/WinDrvr > Remove StopSpam to reply > > "Alexander Grigoriev" <al...(a)earthlink.net> wrote in message > > news:%23C7XTiBkKHA.4356(a)TK2MSFTNGP06.phx.gbl... > > > > > > > Considering that all new computers are x64 compatible, with memory > > >=2GB, > > and most OEMs are shipping x64 flavor installed by default, this > > exercise > > can be compared to collecting drops from liquor bottles for a morning > > hangover fix... Not that I ever did that... > > > "Pavel Lebedinsky [MSFT]" <pa...(a)online.microsoft.com> wrote in message > >news:OwmRwS2jKHA.2132(a)TK2MSFTNGP05.phx.gbl... > >>> I would call this micro-optimization, rudiment from NT 3.1, which ran > >>> on 32 MB. I don't argue against paged pool, but paged kernel code > >>> should just go away. And paged kernel stacks, too > > >> If you ask the Windows perf team, they will probably say that > >> saving 10 MB of nonpaged memory is a major achievement, not a > >> micro-optimization. > > >> During win7 the perf team filed hundreds of bugs against all kinds > >> of components across Windows (not just drivers), asking them to > >> reduce nonpaged footprint, copy-on-write pages in user space etc. > >> Sometimes the savings were just a few pages per component, > >> but together they are a big part of why win7 is the only version > >> of Windows (except maybe NT 3.5/3.51) to have a smaller > >> memory footprint than the previous one. > > >>> Better memory usage optimization would be to fix file caching. > > >> That's like saying that you shouldn't try to make a plane lighter > >> until you can figure out how to make the engines more powerful. > >> Why not try to do both at the same time? > > >> -- > >> Pavel Lebedinsky/Windows Fundamentals Test > >> This posting is provided "AS IS" with no warranties, and confers no > >> rights. > > > __________ Information from ESET NOD32 Antivirus, version of virus > > signature database 4753 (20100108) __________ > > > The message was checked by ESET NOD32 Antivirus. > > >http://www.eset.com > > __________ Information from ESET NOD32 Antivirus, version of virus > signature database 4753 (20100108) __________ > > The message was checked by ESET NOD32 Antivirus. > > http://www.eset.com- Hide quoted text - > > - Show quoted text - __________ Information from ESET NOD32 Antivirus, version of virus signature database 4754 (20100108) __________ The message was checked by ESET NOD32 Antivirus. http://www.eset.com __________ Information from ESET NOD32 Antivirus, version of virus signature database 4754 (20100108) __________ The message was checked by ESET NOD32 Antivirus. http://www.eset.com
From: Pavel A. on 8 Jan 2010 13:35
This is optimization. Every developer can consider for his specific project when to do it, or maybe not do it at all. It seems that MS was motivated enough to optimize win7, and they did it well. Now we have more space and can afford being sloppy with our stuff ;) Regards, --pa |