Re: Swap device vs Swap file

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi!

On 15:53 Sun 26 Oct     , Vimal wrote:
> > cases the system might not be able to swap out memory and trigger the oom
> > killer...
> 
> Will there be enough memory for the oom killer? :-) I mean, oom-killer
> is a function, that would require some stack space. It has to decide
> which process to kill, and then, kill it. Is it guaranteed that this
> killer doesn't need memory?

There are emergency memory pools. Their purpose is to reserve memory for
situations which require allocating memory to free more memory. You can
alloc memory of these pools by additg the flag GFP_HIGH. I guess the oom
killer does so.

> > There is a thing "plan 9 file system" in the Linux kernel, too, but I have
> > never used it.
> >        -Michi
> 
> Thanks, I will check it out.
> 
> This was the reason I had the question:
> 
> kmalloc uses a GFP_NOIO flag, which makes sure that IO won't occur
> when memory is allocated. There is also another flag, called,
> GFP_NOFS, which guarantees that no file system calls will be made. How
> do the two flags differ?

NOIO = no operations on e.g. block devices
NOFS = no file system operations

NOIO is intended to be used by block device drivers
NOFS is intended to be used by file systems

A block device driver does not want a kmalloc to initiate another block device
operation. The some thing is the case for file systems.

> The point is that -- NOFS might initiate disk operations, if swap were
> a device, to fulfill a memory request by (say) flushing some block
> caches. NOIO will make sure this doesn't happen.

Exactly.

> But, consider the following situation:
> * Swap device is over a network
> * kmalloc(size, GFP_NOFS) is called
> 
> The question arose when I wondered about this: Does having a swap
> device guarantee that no FS operations will take place, during a
> kalloc()? It seems like in the above case, a FS operaiton will be
> involved, via NFS.

1) If you specify GFP_NOFS, no file system operations will take place.

2) A network block device is not a filesystem. Therefore swapping operations
may happen.

3) If you have not specified GFP_NOFS, file system operation may happen. It
does not mapper whether you have (NFS) file backed, partition backed, network
block device backed swap. They may even occour if there is no swap at all. The
kernel might decide to write some dirty pages (pages used for the in-kernel
hard-disk write-cache).

> And finally, as far as the host system is concerned, is a swap device
> over NFS equivalent to having a swap file over NFS?

Swap device over NFS = network block device
Swap file over NFS = network file system
These are different protocols, providing a block device or a file system.
	-Michi
-- 
programing a layer 3+4 network protocol for mesh networks
see http://michaelblizek.twilightparadox.com


--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux