Browse Source

* doc/apt.conf.5.xml:

- add and document APT::Cache-{Start,Grow,Limit} options for mmap control
tags/debian/0.8.0
David Kalnischkies 11 years ago
parent
commit
dcdf1ef18b
6 changed files with 39 additions and 11 deletions
  1. +2
    -0
      apt-pkg/contrib/mmap.cc
  2. +16
    -6
      apt-pkg/pkgcachegen.cc
  3. +1
    -0
      apt-pkg/pkgcachegen.h
  4. +3
    -1
      debian/changelog
  5. +14
    -3
      doc/apt.conf.5.xml
  6. +3
    -1
      doc/examples/configure-index

+ 2
- 0
apt-pkg/contrib/mmap.cc View File

@@ -398,6 +398,8 @@ bool DynamicMMap::Grow() {
if (Limit != 0 && WorkSpace >= Limit)
return _error->Error(_("Unable to increase the size of the MMap as the "
"limit of %lu bytes is already reached."), Limit);
if (GrowFactor <= 0)
return _error->Error(_("Unable to increase size of the MMap as automatic growing is disabled by user."));

unsigned long const newSize = WorkSpace + GrowFactor;



+ 16
- 6
apt-pkg/pkgcachegen.cc View File

@@ -1094,6 +1094,18 @@ static bool BuildCache(pkgCacheGenerator &Gen,
return true;
}
/*}}}*/
DynamicMMap* pkgCacheGenerator::CreateDynamicMMap(FileFd *CacheF, unsigned long Flags) {
unsigned long const MapStart = _config->FindI("APT::Cache-Start", 24*1024*1024);
unsigned long const MapGrow = _config->FindI("APT::Cache-Grow", 1*1024*1024);
unsigned long const MapLimit = _config->FindI("APT::Cache-Limit", 0);
Flags |= MMap::Moveable;
if (_config->FindB("APT::Cache-Fallback", false) == true)
Flags |= MMap::Fallback;
if (CacheF != NULL)
return new DynamicMMap(*CacheF, Flags, MapStart, MapGrow, MapLimit);
else
return new DynamicMMap(Flags, MapStart, MapGrow, MapLimit);
}
// CacheGenerator::MakeStatusCache - Construct the status cache /*{{{*/
// ---------------------------------------------------------------------
/* This makes sure that the status cache (the cache that has all
@@ -1109,7 +1121,6 @@ bool pkgCacheGenerator::MakeStatusCache(pkgSourceList &List,OpProgress *Progress
MMap **OutMap,bool AllowMem)
{
bool const Debug = _config->FindB("Debug::pkgCacheGen", false);
unsigned long const MapSize = _config->FindI("APT::Cache-Limit",24*1024*1024);
vector<pkgIndexFile *> Files;
for (vector<metaIndex *>::const_iterator i = List.begin();
@@ -1181,7 +1192,7 @@ bool pkgCacheGenerator::MakeStatusCache(pkgSourceList &List,OpProgress *Progress
unlink(CacheFile.c_str());
CacheF = new FileFd(CacheFile,FileFd::WriteEmpty);
fchmod(CacheF->Fd(),0644);
Map = new DynamicMMap(*CacheF,MMap::Public | MMap::Moveable, MapSize);
Map = CreateDynamicMMap(CacheF, MMap::Public);
if (_error->PendingError() == true)
return false;
if (Debug == true)
@@ -1190,7 +1201,7 @@ bool pkgCacheGenerator::MakeStatusCache(pkgSourceList &List,OpProgress *Progress
else
{
// Just build it in memory..
Map = new DynamicMMap(MMap::Moveable, MapSize);
Map = CreateDynamicMMap(NULL);
if (Debug == true)
std::clog << "Open memory Map (not filebased)" << std::endl;
}
@@ -1297,13 +1308,12 @@ __deprecated bool pkgMakeOnlyStatusCache(OpProgress &Progress,DynamicMMap **OutM
{ return pkgCacheGenerator::MakeOnlyStatusCache(&Progress, OutMap); }
bool pkgCacheGenerator::MakeOnlyStatusCache(OpProgress *Progress,DynamicMMap **OutMap)
{
unsigned long MapSize = _config->FindI("APT::Cache-Limit",20*1024*1024);
vector<pkgIndexFile *> Files;
unsigned long EndOfSource = Files.size();
if (_system->AddStatusFiles(Files) == false)
return false;
SPtr<DynamicMMap> Map = new DynamicMMap(MMap::Moveable, MapSize);
SPtr<DynamicMMap> Map = CreateDynamicMMap(NULL);
unsigned long CurrentSize = 0;
unsigned long TotalSize = 0;


+ 1
- 0
apt-pkg/pkgcachegen.h View File

@@ -101,6 +101,7 @@ class pkgCacheGenerator /*{{{*/
static bool MakeStatusCache(pkgSourceList &List,OpProgress *Progress,
MMap **OutMap = 0,bool AllowMem = false);
static bool MakeOnlyStatusCache(OpProgress *Progress,DynamicMMap **OutMap);
static DynamicMMap* CreateDynamicMMap(FileFd *CacheF, unsigned long Flags = 0);

void ReMap(void const * const oldMap, void const * const newMap);



+ 3
- 1
debian/changelog View File

@@ -40,6 +40,8 @@ apt (0.7.26~exp8) UNRELEASED; urgency=low
* apt-pkg/pkgcachegen.{cc,h}:
- make the used MMap moveable (and therefore dynamic resizeable) by
applying (some) mad pointer magic (Closes: #195018)
* doc/apt.conf.5.xml:
- add and document APT::Cache-{Start,Grow,Limit} options for mmap control

[ Julian Andres Klode ]
* methods/ftp.h:
@@ -55,7 +57,7 @@ apt (0.7.26~exp8) UNRELEASED; urgency=low
* debian/control:
- Set Standards-Version to 3.9.0

-- David Kalnischkies <kalnischkies@gmail.com> Mon, 05 Jul 2010 12:05:30 +0200
-- David Kalnischkies <kalnischkies@gmail.com> Fri, 09 Jul 2010 16:55:53 +0200

apt (0.7.26~exp7) experimental; urgency=low



+ 14
- 3
doc/apt.conf.5.xml View File

@@ -199,9 +199,20 @@ DPkg::Pre-Install-Pkgs {"/usr/sbin/dpkg-preconfigure --apt";};
anything that those packages depend on.</para></listitem>
</varlistentry>

<varlistentry><term>Cache-Limit</term>
<listitem><para>APT uses a fixed size memory mapped cache file to store the 'available'
information. This sets the size of that cache (in bytes).</para></listitem>
<varlistentry><term>Cache-Start, Cache-Grow and Cache-Limit</term>
<listitem><para>APT uses since version 0.7.26 a resizable memory mapped cache file to store the 'available'
information. <literal>Cache-Start</literal> acts as a hint to which size the Cache will grow
and is therefore the amount of memory APT will request at startup. The default value is
20971520 bytes (~20 MB). Note that these amount of space need to be available for APT
otherwise it will likely fail ungracefully, so for memory restricted devices these value should
be lowered while on systems with a lot of configured sources this might be increased.
<literal>Cache-Grow</literal> defines in byte with the default of 1048576 (~1 MB) how much
the Cache size will be increased in the event the space defined by <literal>Cache-Start</literal>
is not enough. These value will be applied again and again until either the cache is big
enough to store all information or the size of the cache reaches the <literal>Cache-Limit</literal>.
The default of <literal>Cache-Limit</literal> is 0 which stands for no limit.
If <literal>Cache-Grow</literal> is set to 0 the automatic grow of the cache is disabled.
</para></listitem>
</varlistentry>

<varlistentry><term>Build-Essential</term>


+ 3
- 1
doc/examples/configure-index View File

@@ -95,7 +95,9 @@ APT
Clean-Installed "true";
Immediate-Configure "true"; // DO NOT turn this off, see the man page
Force-LoopBreak "false"; // DO NOT turn this on, see the man page
Cache-Limit "4194304";
Cache-Start "20971520";
Cache-Grow "1048576";
Cache-Limit "0";
Default-Release "";

// consider Recommends, Suggests as important dependencies that should


Loading…
Cancel
Save