LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 09-29-2011, 07:35 AM   #1
markseger
Member
 
Registered: Jul 2003
Posts: 244

Rep: Reputation: 26
does the kernel report wrong number for unused dentries?


I've been meaning to ask this for a long time. When I added inode stats to collectl one of the driving reasons was because sar did it. I had never paid that much attention to the output other than to confirm it matched, which it did.

But some time later, and this was still awhile ago, I did some experiments to make sure the numbers were being reported correctly and I believe they are not! The one problem I see is the number of unused dentry cache entries. It's described in the /proc man page as:

Code:
/proc/sys/fs/dentry-state (since Linux 2.2)
              This file contains information about the status of the directory
              cache (dcache).   The  file  contains  six  numbers,  nr_dentry,
              nr_unused,   age_limit   (age  in  seconds),  want_pages  (pages
              requested by system) and two dummy values.

              * nr_dentry  is  the  number  of  allocated   dentries   (dcache
                entries).  This field is unused in Linux 2.2.

              * nr_unused is the number of unused dentries.
To my way of thinking, if something is 'unused' and you start using if by creating a bunch of directories, I'd expect that number to go down since now more are being used. However that number goes up instead! When I create 1K files it goes up by 1K rather than down.

On the one hand it's hard to believe this has been around since almost the dawn of linux and it's documented as 'unused'. So either I'm misinterpretting it or nobody noticed/cared. Thoughts?

-mark
 
Old 09-29-2011, 01:13 PM   #2
markseger
Member
 
Registered: Jul 2003
Posts: 244

Original Poster
Rep: Reputation: 26
Ok, after some more digging I’m starting to think perhaps this is correct but extremely poorly documented! I think this is referring to dentry slabs. Check out the following slab usage before/after creating 100 directories:

Code:
# SLAB DETAIL
#                           <-----------Objects----------><---------Slab Allocation------><---Change-->
#Name                       InUse   Bytes   Alloc   Bytes   InUse   Bytes   Total   Bytes   Diff    Pct
dentry_cache               128142  27029K  128142  27029K    7119  28476K    7119  28476K      0    0.0

# SLAB DETAIL
#                           <-----------Objects----------><---------Slab Allocation------><---Change-->
#Name                       InUse   Bytes   Alloc   Bytes   InUse   Bytes   Total   Bytes   Diff    Pct
dentry_cache               128210  27044K  128232  27048K    7124  28496K    7124  28496K      0    0.0
as you can see the number of objects in use have increased by 68 – still now sure why not 100. If I look at the contents of /proc/sys/fs/dentry-state before and after I see:

Code:
[root@poker collectl]# cat /proc/sys/fs/dentry-state
127948  115769  45      0       0       0
[root@poker collectl]# cat /proc/sys/fs/dentry-state
128056  115869  45      0       0       0
The first is the number of entries and the second the number of unused ones. The number of entries did indeed increase by over 100 and is close to what is in /proc/slabinfo, but not quite. As I said in the base note the number of unused entries also increased by 100. I’d have also expected the number of unused to be the difference between InUse and Alloc but according to collectl these only differ by 22 in the ‘after’ numbers and are the same in the before.

So I think this may be a closer approximation they still don’t agree. But it’s also possible that as an older artifact the/proc/sys entry may not be as up to date? Or maybe IT is the one that’s more accurate.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
(Solved) Wrong Free Space Report technik733 Linux - General 3 03-04-2010 04:28 PM
wrong report on fat partition size eXeCuTioN Linux - Newbie 5 04-03-2006 06:31 PM
Unused kernel modules : How to NOT load? _UnPrEdictAbLe_ Linux - Software 0 08-19-2004 01:19 AM
Bug report: wrong date/time format in last visited wipe LQ Suggestions & Feedback 0 07-29-2004 06:21 AM
kernel stops as 'freeing unused kernel memory' orinjus Linux - Software 3 05-11-2003 04:21 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 12:51 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration